Launchpad mangled my example code. Here it is again:
>>> def enc(password): ... return AES.new("0123456789abcdef", AES.MODE_CFB, "\0"*16) \ ... .encrypt(password).encode('hex') ... >>> enc("a") '6a' >>> enc("ab") '6af9' >>> enc("abc") '6af9bb' >>> enc("abc0") '6af9bb62' >>> enc("abc1") '6af9bb63' >>> enc("abc2") '6af9bb60' >>> enc("abc3") '6af9bb61' >>> enc("abc4") '6af9bb66'
Launchpad mangled my example code. Here it is again:
>>> def enc(password): "0123456789abcd ef", AES.MODE_CFB, "\0"*16) \ password) .encode( 'hex')
... return AES.new(
... .encrypt(
...
>>> enc("a")
'6a'
>>> enc("ab")
'6af9'
>>> enc("abc")
'6af9bb'
>>> enc("abc0")
'6af9bb62'
>>> enc("abc1")
'6af9bb63'
>>> enc("abc2")
'6af9bb60'
>>> enc("abc3")
'6af9bb61'
>>> enc("abc4")
'6af9bb66'