mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2024-11-19 18:00:17 +01:00
16 lines
393 B
JavaScript
16 lines
393 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);
|
|
let str = false;
|
|
try {
|
|
str = bytes.toString(CryptoJS.enc.Utf8);
|
|
} catch (e) {}
|
|
return str;
|
|
};
|