PyCrypto problem using AES+CTR
The counter must return the same on decryption as it did on encryption, as you intuit, so, one (NOT SECURE AT ALL) way to do it is: >>> secret = os.urandom(16) >>> crypto = AES.new(os.urandom(32), AES.MODE_CTR, counter=lambda: secret) >>> encrypted = crypto.encrypt(“aaaaaaaaaaaaaaaa”) >>> print crypto.decrypt(encrypted) aaaaaaaaaaaaaaaa CTR is a block cipher, so the “16-at-a-time” constraint … Read more