Answer the question
In order to leave comments, you need to log in
How to decrypt and encrypt aes-128-cbc just like CryptoJS?
Encrypted like this:
CryptoJS.AES.encrypt('Plain Text', 'password').toString()
U2FsdGVkX1/lXDct6Gdc+rxKuhSvS6035ZYKeh1DLaY=
Salted__
, and further, as far as I understand, n bytes of the hash go. And then comes the encrypted text itself. from Crypto.Random import get_random_bytes
from Crypto.Util.Padding import unpad
from Crypto.Cipher import AES
from base64 import b64decode
#CBC mode with random IV
iv = get_random_bytes(16)
def decrypt(enc, key, iv):
enc = b64decode(enc)
cipher = AES.new(key.encode('utf-8'), AES.MODE_CBC, b64decode(iv))
return unpad(cipher.decrypt(enc), 16)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question