From edca4d15a53edec6a000d432f57830fd4b7ffb9b Mon Sep 17 00:00:00 2001 From: Anton Rieder Date: Sat, 16 Jun 2012 00:16:14 +0200 Subject: Using MODE_CBC instead of MODE_ECB in README example ECB mode has known disadvantages and while the use of it could be intended, I think it would be a good idea to have a 'stronger' mode in the example. Thus, I adopted the example in the README to make use of MODE_CBC instead of MODE_ECB. --- README | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README b/README index 7f310f0..814bcc2 100644 --- a/README +++ b/README @@ -21,12 +21,12 @@ An example usage of the SHA256 module is: An example usage of an encryption algorithm (AES, in this case) is: >>> from Crypto.Cipher import AES ->>> obj = AES.new('This is a key456', AES.MODE_ECB) +>>> obj = AES.new('This is a key123', AES.MODE_CBC, 'This is an IV456') >>> message = "The answer is no" >>> ciphertext = obj.encrypt(message) >>> ciphertext -'o\x1aq_{P+\xd0\x07\xce\x89\xd1=M\x989' ->>> obj2 = AES.new('This is a key456', AES.MODE_ECB) +'\xd6\x83\x8dd!VT\x92\xaa`A\x05\xe0\x9b\x8b\xf1' +>>> obj2 = AES.new('This is a key123', AES.MODE_CBC, 'This is an IV456') >>> obj2.decrypt(ciphertext) 'The answer is no' -- cgit v1.2.1