Hi,

If I run the following, for openSSL:

echo -n "0123456789abcdef0123456789abcdef" | openssl aes-128-ecb
-nosalt -nopad | xxd

and enter the key "YELLOW SUBMARINE", I get the following ciphertext:

a2a5 8316 129f c596 8341 c78a 0c36 5d20
a2a5 8316 129f c596 8341 c78a 0c36 5d20

Yet in M2Crypto, the following code:

import M2Crypto
cipher=M2Crypto.EVP.Cipher('aes_128_ecb',b'YELLOW SUBMARINE',"", op=1,
padding=0, salt=None)
out=b''
plaintext=b'0123456789abcdef0123456789abcdef'
out=out+cipher.update(plaintext)
print ' '.join(x.encode('hex') for x in out)

Outputs:

20 1e 80 2f 7b 6a ce 6f 6c d0 a7 43 ba 78 ae ad
20 1e 80 2f 7b 6a ce 6f 6c d0 a7 43 ba 78 ae ad

(line breaks added for clarity)

What is the cause of this discrepancy? Both are 128-bit AES in ECB
mode. M2Crypto doesn't appear to be salting, and padding should be
unnecessary in any case with this plaintext.

Thanks,
James McMurray
_______________________________________________
chandler-users@osafoundation.org mailing list
unsubscribe here: http://lists.osafoundation.org/mailman/listinfo/chandler-users
Chandler wiki: http://chandlerproject.org/wikihome

Reply via email to