Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Encrypt and Decrypt in bcryptjs

I want to encrypt an email id and decrypt that how? I checked the documentation, but it only shows password encryption, and that is showing a true or false result.

Any way to encrypt and decrypt email id, please help me?

like image 279
Andrew Avatar asked Jan 27 '23 08:01

Andrew


1 Answers

You can use cryptr for encryption and decryption. With bcrypt you can't perform encryption and decryption of data. cryptr can be used as follows:

const Cryptr = require('cryptr');
const cryptr = new Cryptr('myTotalySecretKey');
let email = [email protected];
let encryptdEmail = cryptr.encrypt(email);
console.log("Decrypted email = ", cryptr.decrypt(encryptdEmail ));
like image 82
Sukanya Purushothaman Avatar answered Jan 28 '23 23:01

Sukanya Purushothaman