0
我需要移植这段JavaScript代码到Python:pycrypto AES与密码,而不是键+ IV
var decrypt = function (text, password){
var decipher = crypto.createDecipher('aes-256-cbc',password);
var dec = decipher.update(text,'hex','utf8');
dec += decipher.final('utf8');
return dec;
}
的问题是,PyCrypto库需要一个键+ IV,而不仅仅是一个密码,我不不知道如何模仿JavaScript的方法crypto.createDecipher
。
非常感谢!
https://nodejs.org/api/crypto.html#crypto_crypto_createdecipher_algorithm_password_options:“crypto.createDecipher(的实现)派生使用OpenSSL的功能键EVP_BytesToKey与摘要算法设置为MD5,一次迭代,并没有盐“(如果你能够改变加密,你应该这样做,因为建议在同一文件。) – Ryan
我试了一下,但我不不知道如何实现它D: –