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: –