I'm implementing string2key stuff for OpenPGP, and Blowfish reports a keysize of 56, but wants 72 bytes for the Serialize.decode instance. If I use buildKey it "works", but the key I get seems to be the wrong one (stuff encrypted with GPG does not decrypt).
The AES instances work fine either way.
Hmm, ok, I solved it like this:
newtype Blowfish128 = Blowfish128 Blowfish
instance Serialize.Serialize Blowfish128 where
put (Blowfish128 b) = Serialize.put b
get = fmap Blowfish128 Serialize.get
instance BlockCipher Blowfish128 where
blockSize = retag (blockSize :: Tagged Blowfish BitLength)
encryptBlock (Blowfish128 k) = encryptBlock k
decryptBlock (Blowfish128 k) = decryptBlock k
buildKey = fmap Blowfish128 . buildKey
keyLength = Tagged 128
Why is that not in a form of a bugfix for the original instance instead of redefining on your side the instance ?
@vincenthz because your instance isn't really broken, it's just that Blowfish works for multiple keysizes and your type is for a different size than I needed.
remove dodgy instance (and most likely useless instance) of blowfish …
Blowfish support many key type, so it's up to the user to define
instance that make sense. for example "Blowfish128" with a keysize of 128.