[Answer]-Python M2Crypto's AES 128 Encryption Different From PHP's Mcrypt

1👍

Your PHP $iv appears to be a string of ASCII zeros (so, byte 0x30), where in the python iv you appear to be using literal 0x00 bytes.

EDIT

You also appear to be passing the ciphertext through b64encode and b64decode. Are you quite sure these are exact inverses? No line breaks, formatting, trailing new lines, etc?

👤phs

0👍

Quick googling revealed the following snippet: http://www.example-code.com/python/crypt2_aes_matchPhp.asp

Maybe worth giving it a try?

Leave a comment