Browse Source

Update HashTrees.hs

master
nisstyre56 11 years ago
parent
commit
0f54a0975e
  1. 4
      HashTrees.hs

4
HashTrees.hs

@ -1,11 +1,9 @@
module HashTrees where module HashTrees where
import Data.Digest.Pure.SHA import Data.Digest.Pure.SHA
import Data.List
import qualified Data.ByteString.Lazy as BL import qualified Data.ByteString.Lazy as BL
import Control.Monad import Control.Monad
import Data.List import Data.List
import Data.Bits
data HashTree k a = Leaf | HashTree (Digest k) (HashTree k a) (HashTree k a) deriving (Show) 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 padHashes xs = pad' 0 xs where
pad' n ([]) = [] ++ (take ((nextPowerOf n) - n) $ repeat BL.empty) pad' n ([]) = [] ++ (take ((nextPowerOf n) - n) $ repeat BL.empty)
pad' n (x:xs) = x : (pad' (n +1) xs) pad' n (x:xs) = x : (pad' (n +1) xs)

Loading…
Cancel
Save