better forcing of hash

This commit is contained in:
Joey Hess 2016-02-26 16:36:24 -04:00
parent facc50d965
commit ac8af8da07
Failed to extract signature

View file

@ -171,11 +171,9 @@ hashFile hash file filesize = go hash
go (SkeinHash hashsize) = use (skeinHasher hashsize)
use hasher = liftIO $ do
hdl <- openBinaryFile file ReadMode
b <- L.hGetContents hdl
let !hsh = hasher b
hClose hdl
return hsh
h <- hasher <$> L.readFile file
-- Force full evaluation so file is read and closed.
return (length h `seq` h)
usehasher hashsize = case shaHasher hashsize filesize of
Left sha -> use sha