From: SourceForge.net <no...@so...> - 2006-04-20 19:58:19
|
Bugs item #1473773, was opened at 2006-04-20 18:59 Message generated for change (Comment added) made by calzas You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=120937&aid=1473773&group_id=20937 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: Rejected Priority: 5 Submitted By: Juan de las Calzas Verdes (calzas) Assigned to: Nobody/Anonymous (nobody) Summary: Every mode except ECB in AES fails? Initial Comment: See a little script and its results -------------------------- import Crypto.Cipher.AES import binascii AES = Crypto.Cipher.AES text = 'abcdefghijklmnop' myIV = '0123456789ABCDEF' mykey = '16 bytes text XX' print 'Original: ', binascii.hexlify(text) for mode in range(1, 6): obj = AES.new(mykey, mode, myIV) dec = obj.decrypt(obj.encrypt(text)) print 'Mode: ', mode, ' Decr(Encr(Original)): ', binascii.hexlify(dec) -------------------------- Output: Original: 6162636465666768696a6b6c6d6e6f70 Mode: 1 Decr(Encr(Original)): 6162636465666768696a6b6c6d6e6f70 Mode: 2 Decr(Encr(Original)): fe8c779f1bf840fc83de99bf8ddca587 Mode: 3 Decr(Encr(Original)): 776978676b3c2d69180143ed54cfd062 Mode: 4 Decr(Encr(Original)): 9ef7106d9d229f2d696a6b6c6d6e6f70 Mode: 5 Decr(Encr(Original)): c2e0fd3ee88477829300f6a77565cbc0 Why doesn't it work? Shouldn't it? It does work if you create different objects for encryption and decryption. ---------------------------------------------------------------------- >Comment By: Juan de las Calzas Verdes (calzas) Date: 2006-04-20 19:58 Message: Logged In: YES user_id=1506211 Forget it. Of course the objects have to "remember" the state of the enciphering process in most of the modes. I am stupid. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=120937&aid=1473773&group_id=20937 |