[pycrypto] jibberish output with blowfish cbc

tannhauser tannhauser at nerdshack.com
Sat Feb 14 13:37:11 CST 2009


hello,

i use the latest release of amk.ca, v2.0.1 and python 2.6.1. 
i have a problem when using blowfish with the cbc-mode. 

some example code:

[code]
#!/usr/bin/env python
from Crypto.Cipher import Blowfish

key = 'xyz123'
iv = 'aaaaaaaa'
obj = Blowfish.new(key, Blowfish.MODE_CBC, iv)
# use misspelling as padding technique
plain = 'yet another test sentenc'
#encrypt
ciph = obj.encrypt(plain)
# decrypt
plain = obj.decrypt(ciph)
print plain
[/code]

obviously, "print plain" should give me "yet another test sentenc"
well, it does not, instead the first 8 characters are something
jibberish, the rest is ok: "ڦ¼obf²her test sentenc". i don't have that
problem with MODE_ECB.

any ideas?

th



More information about the pycrypto mailing list