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.
tanghe-report/report-ui/src/utils/aes.js

13 lines
560 B
JavaScript

import CryptoJS from 'crypto-js'
export function aesEncrypt(word){
let key = CryptoJS.enc.Utf8.parse("BGxdEUOZkXka4HSj");
let srcs = CryptoJS.enc.Utf8.parse(word);
let encrypted = CryptoJS.AES.encrypt(srcs, key, {mode:CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7});
return encrypted.toString();
}
export function aesDecrypt(word){
let key = CryptoJS.enc.Utf8.parse("BGxdEUOZkXka4HSj");
let decrypt = CryptoJS.AES.decrypt(word, key, {mode:CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7});
return CryptoJS.enc.Utf8.stringify(decrypt).toString();
}