new_hopeN
Denoβ€’3y agoβ€’
2 replies
new_hope

When I use crypto in this code, it returns 'Unknown cipher.'

const secret ="1111111111111111111";
let encryptedText='test';
const decipher = crypto.createDecipheriv('aes-256-cbc', secret, secret.slice(0, 16));
decipher.setAutoPadding(true);
let decrypted = decipher.update(encryptedText.slice(16), 'base64', 'utf8');
decrypted += decipher.final('utf8');

How to fix it?
Was this page helpful?