I am attempting to learn python and cryptography at the same time.
I am trying to alter the cipher text by a bit (or more) to see the effect it would have on my plaintext when decrypting.
For example:
from Crypto.Cipher import AES
import base64
import os
BLOCK_SIZE = 16
key = os.urandom(BLOCK_SIZE)
PADDING = '{'
pad = lambda s: s + (BLOCK_SIZE - len(s) % BLOCK_SIZE) * PADDING
EncodeAES = lambda c, s: base64.b64encode(c.encrypt(pad(s)))
DecodeAES = lambda c, e: c.decrypt(base64.b64decode(e)).rstrip(PADDING)
cipher = AES.new(key)
# encode a string
encoded = EncodeAES(cipher, 'This is some text.')
print 'Encrypted string:', encoded
# decode the encoded string
decoded = DecodeAES(cipher, encoded)
print 'Decrypted string:', decoded
So I want to decrypt again except having modified the cipher text ("encoded") before decrypting.
Thanks.