You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
560 B
JavaScript
13 lines
560 B
JavaScript
import CryptoJS from 'crypto-js'
|
|
export function aesEncrypt(word){
|
|
var key = CryptoJS.enc.Utf8.parse("BGxdEUOZkXka4HSj");
|
|
var srcs = CryptoJS.enc.Utf8.parse(word);
|
|
var encrypted = CryptoJS.AES.encrypt(srcs, key, {mode:CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7});
|
|
return encrypted.toString();
|
|
}
|
|
export function aesDecrypt(word){
|
|
var key = CryptoJS.enc.Utf8.parse("BGxdEUOZkXka4HSj");
|
|
var decrypt = CryptoJS.AES.decrypt(word, key, {mode:CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7});
|
|
return CryptoJS.enc.Utf8.stringify(decrypt).toString();
|
|
}
|