Closed singpolyma closed 11 years ago
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.
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 usebuildKey
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.