I use Node.js for encrypt and decrypt some Data and store them in Database, everything worked fine until my cpu usage increased with more request for decrypting and now I decided to move these two functions to python:
const key = '' // unfortunately 39 bytes string (by mistake)
module.exports.encrypt = function (text) {
let cipher = crypto.createCipher('aes-256-ctr', key)
let crypted = cipher.update(text, 'utf8', 'hex');
crypted += cipher.final('hex');
return crypted;
};
module.exports.decrypt = function (text) {
let decipher = crypto.createDecipher('aes-256-ctr', key)
let dec = decipher.update(text, 'hex', 'utf8');
dec += decipher.final('utf8');
return dec;
};
now I have a lot of encrypted data in database which encrypted with wrong key (But in node.js with crypto module it works fine) I tried several python code to decrypt my encrypted data with that key, but none of them worked (they only accept 32 bytes key), is there any way to move this two method to python? (without changing key)