[PYTHON-CRYPTO] amkCrypto: Cipher decrypt(string) output

Jason R. Mastaler jason-list-python-crypto at MASTALER.COM
Wed Mar 28 08:24:54 CEST 2001


Andrew Archibald <aarchiba at YAHOO.COM> writes:

> You're using CBC mode, which has state (You should be supplying an
> IV when you create the Blowfish object, BTW), and you're re-using a
> Blowfish object.  That is, when you create a CBC-mode encryptor
> object, you supply an initialization vector.  Every time you encrypt
> a block, the IV is XORed into the plaintext, the result is
> encrypted, and the output replaces the IV.  So if you encrypt the
> same string more than once with the same object, you get different
> data.  This is a feature.

So, if given a cipherobj.encrypt(string), the only way to get back the
identical plaintext string is to create a second Blowfish object with
the same key AND the same IV, and then use that to decrypt?  I thought
one only needed the key to go from ciphertext to plaintext?





More information about the python-crypto mailing list