ensure that hash representations don't change in future

This commit is contained in:
Joey Hess 2013-10-01 21:10:56 -04:00
parent 29385dc393
commit 547a18019f
3 changed files with 23 additions and 6 deletions

View file

@ -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