From 8aff1b11f2c6be205dccf1a30f422ee7ed5af4d2 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 1 Oct 2013 21:10:56 -0400 Subject: ensure that hash representations don't change in future --- Backend/Hash.hs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'Backend') 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 -- cgit v1.2.3