Skip to content Skip to sidebar Skip to footer

Aes Ecb Encrypting In Python

My main goal is to rewrite this javascript into python password = 'AAAABBBBCCCC'; passwordMd5 = CryptoJS.MD5(password); //e1b6b2b3211076a71632bbf2ad0edc05 passwordKey = Crypto

Solution 1:

Actually AES key should be either 16, 24 or 32 bytes long.

You are using the hexdigest of a sha256 hash as a key, which results in a 64 bytes string. Instead do the following:

password = (hashlib.sha256((passwordMd5 + prelogin["v1"])).hexdigest() + prelogin["v2"])
passwordKey = hashlib.sha256(password).digest()

Post a Comment for "Aes Ecb Encrypting In Python"