|
|
@ -1,11 +1,9 @@ |
|
|
|
module HashTrees where |
|
|
|
|
|
|
|
import Data.Digest.Pure.SHA |
|
|
|
import Data.List |
|
|
|
import qualified Data.ByteString.Lazy as BL |
|
|
|
import Control.Monad |
|
|
|
import Data.List |
|
|
|
import Data.Bits |
|
|
|
|
|
|
|
data HashTree k a = Leaf | HashTree (Digest k) (HashTree k a) (HashTree k a) deriving (Show) |
|
|
|
|
|
|
@ -43,4 +41,4 @@ nextPowerOf n = 2 ^ (ceiling $ logBase 2 $ fromIntegral n) |
|
|
|
padHashes xs = pad' 0 xs where |
|
|
|
pad' n ([]) = [] ++ (take ((nextPowerOf n) - n) $ repeat BL.empty) |
|
|
|
pad' n (x:xs) = x : (pad' (n +1) xs) |
|
|
|
|
|
|
|
|
|
|
|