[pycrypto] AES, MODE_CTR

Dave Pawson dave.pawson at gmail.com
Wed Dec 4 02:32:53 PST 2013


Using the (part) example from
https://www.dlitz.net/software/pycrypto/api/current/Crypto.Util.Counter-module.html


    def test_AES5(self):
        pt=b' '*10
        ctr=Counter.new(128)
        cipher = AES.new(b' '*16, AES.MODE_CTR, counter=ctr)
        ct = cipher.encrypt(pt)
        decipher = AES.new(b' '*16, AES.MODE_CTR, counter=ctr)
        ptr = decipher.decrypt(ct)
        self.assertEqual(pt,ptr)

fails,
 self.assertEqual(pt,ptr)
AssertionError: b'          ' != b'\x18k\xf2\x92\xd4\xcc\x15\xd1\r\xb3'


Could someone put me right please?

TiA


-- 
Dave Pawson
XSLT XSL-FO FAQ.
Docbook FAQ.
http://www.dpawson.co.uk


More information about the pycrypto mailing list