The following code snippet yields different results for both packages.
import Crypto.Hash
import qualified Data.ByteString.Char8 as BSC
hash' bs = hash bs :: Digest MD5
show . hash' . BSC.pack $ "foo"
-- Returns
-- "\"acbd18db4cc2f85cedef654fccc4a4d8\"" for cryptonite
-- "acbd18db4cc2f85cedef654fccc4a4d8" for cryptohash
This is probably due to the different Show instances:
Cryptonite:
instance Show (Digest a) where
show (Digest bs) = show (B.convertToBase B.Base16 bs :: Bytes)
Cryptohash:
instance Show (Digest a) where
show (Digest bs) = BC.unpack $ toHex bs
Will the instance in cryptonite stay as it is?
This would prevent cryptonite from being used as a drop-in replacement
for cryptohash, but maybe it isn't intended as such.
The following code snippet yields different results for both packages.
This is probably due to the different
Show
instances:Cryptonite:
Cryptohash:
Will the instance in
cryptonite
stay as it is? This would preventcryptonite
from being used as a drop-in replacement forcryptohash
, but maybe it isn't intended as such.