diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-05-27 16:00:44 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-05-27 16:00:44 -0400 |
commit | 7f2181dda5e5acd6b209a58b534d1d8b128c79fe (patch) | |
tree | b0a3bde97a0da32a29b0b63262c2503e4ac2ab03 /Backend | |
parent | 70fbb08468ba893812e5c78d60984c91aff27fdd (diff) |
refactor
Diffstat (limited to 'Backend')
-rw-r--r-- | Backend/Hash.hs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Backend/Hash.hs b/Backend/Hash.hs index 1175af0bd..fd89198d2 100644 --- a/Backend/Hash.hs +++ b/Backend/Hash.hs @@ -173,15 +173,16 @@ shaHasher hashsize filesize | hashsize == 512 = use SysConfig.sha512 sha512 | otherwise = error $ "unsupported sha size " ++ show hashsize where - use Nothing hasher = Left $ show . hasher + use Nothing hasher = Left $ usehasher hasher use (Just c) hasher {- Use builtin, but slightly slower hashing for - smallish files. Cryptohash benchmarks 90 to 101% - faster than external hashers, depending on the hash - and system. So there is no point forking an external - process unless the file is large. -} - | filesize < 1048576 = use Nothing hasher - | otherwise = Right (c, show . hasher) + | filesize < 1048576 = Left $ usehasher hasher + | otherwise = Right (c, usehasher hasher) + usehasher hasher = show . hasher skeinHasher :: HashSize -> (L.ByteString -> String) skeinHasher hashsize |