BlueWallet/encryption.js
2018-03-30 19:31:10 +01:00

12 lines
334 B
JavaScript

let CryptoJS = require('crypto-js');
module.exports.encrypt = function(data, password) {
let ciphertext = CryptoJS.AES.encrypt(data, password);
return ciphertext.toString();
};
module.exports.decrypt = function(data, password) {
let bytes = CryptoJS.AES.decrypt(data, password);
return bytes.toString(CryptoJS.enc.Utf8);
};