[pycrypto] ARC4 problems?

Dave Pawson dave.pawson at gmail.com
Thu Nov 21 01:58:18 PST 2013


Using Python 3

    def test_ARC4_2(self):
        key = b'A long and confidential key'
        msg =b'My secret message'
        nonce = b'Another secret'#Crypto.Random.new().read(16)
        tempkey=SHA.new(key + nonce).digest()
        cipher = ARC4.new(tempkey)
        ciphertext = cipher.encrypt(msg)
        plain      = cipher.decrypt(ciphertext)
        print(plain)

The print is showing
b'\x06\xd6\x96\xe7BEF\xe2\x11\xae\xff\xa5"3nJ1'
which str() won't convert to a string?
  An ecryption problem or encoding?
Am I doing something wrong please?
(just trying to get my head round each of the classes)

regards


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


More information about the pycrypto mailing list