diff options
author | Joey Hess <joey@kitenet.net> | 2013-10-01 21:10:56 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-10-01 21:11:47 -0400 |
commit | 8aff1b11f2c6be205dccf1a30f422ee7ed5af4d2 (patch) | |
tree | df9b94e70d081bc9866d7d8ba85093dc8556aa80 /Backend | |
parent | 56b5aa56f0fcbf28a532317cb81601bb6c41a114 (diff) |
ensure that hash representations don't change in future
Diffstat (limited to 'Backend')
-rw-r--r-- | Backend/Hash.hs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Backend/Hash.hs b/Backend/Hash.hs index 309c0fe9f..d9a1bbc97 100644 --- a/Backend/Hash.hs +++ b/Backend/Hash.hs @@ -136,12 +136,6 @@ hashFile hash file filesize = do =<< externalSHA command hashsize file go (SkeinHash hashsize) = skeinHasher hashsize <$> L.readFile file -skeinHasher :: HashSize -> (L.ByteString -> String) -skeinHasher hashsize - | hashsize == 256 = show . skein256 - | hashsize == 512 = show . skein512 - | otherwise = error $ "bad skein size " ++ show hashsize - shaCommand :: HashSize -> Integer -> Either (L.ByteString -> String) String shaCommand hashsize filesize | hashsize == 1 = use SysConfig.sha1 sha1 @@ -160,3 +154,9 @@ shaCommand hashsize filesize - process unless the file is large. -} | filesize < 1048576 = use Nothing hasher | otherwise = Right c + +skeinHasher :: HashSize -> (L.ByteString -> String) +skeinHasher hashsize + | hashsize == 256 = show . skein256 + | hashsize == 512 = show . skein512 + | otherwise = error $ "bad skein size " ++ show hashsize |