diff options
author | Anton Rieder <aried3r@gmail.com> | 2012-06-16 00:16:14 +0200 |
---|---|---|
committer | Anton Rieder <aried3r@gmail.com> | 2012-06-16 00:16:14 +0200 |
commit | edca4d15a53edec6a000d432f57830fd4b7ffb9b (patch) | |
tree | 4060c2fa983eb6a26d85e46d4f9612ae0fa1268f | |
parent | 125a4f93fa9c798520d08fce9f04c08e3566d98d (diff) | |
download | pycrypto-edca4d15a53edec6a000d432f57830fd4b7ffb9b.tar.gz |
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.
-rw-r--r-- | README | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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' |