[pycrypto] DES3 problem
dave.pawson at gmail.com
Fri Nov 29 07:49:07 PST 2013
On 29 November 2013 15:16, Legrandin <helderijs at gmail.com> wrote:
> The DES3 example you are looking for is actually here:
I can't get that working.
Assuming I'm not unusual in wanting to both encrypt and then decrypt.
It would be very helpful to show the decrypt after the encrypt?
the oddities I'm finding,
1. Why is it sometimes (I don't know why) shown creating two ciphers,
one for encrypt, one for decrypt.
2. The use of a nonce (as per above)
Is it normal to decrypt using
ciphertext=iv + ciphere.encrypt(plaintext)
plain = cipherd.decrypt(ciphertext[16:])
Using the example....
>>> from Crypto.Cipher import DES3
>>> from Crypto import Random
>>> key = b'Sixteen byte key'
>>> iv = Random.new().read(DES3.block_size)
>>> cipher = DES3.new(key, DES3.MODE_OFB, iv)
>>> plaintext = b'sona si latine loqueris '
>>> msg = iv + cipher.encrypt(plaintext)
>>> p = cipher.decrypt(msg[16:])
Any ideas please?
XSLT XSL-FO FAQ.
More information about the pycrypto