I am currently working on encrypting a password using the built-in crypto module. Previously, I used createCipher which is now deprecated. I am wondering if there is still an effective way to achieve this.
Here is the old code snippet:
hashPassword(pass: string) {
const cipher = crypto.createCipher('aes256', 'a pass');
let encrypted = cipher.update(pass, 'utf8', 'hex');
encrypted += cipher.final('hex');
return encrypted;
}
Any suggestions would be greatly appreciated.