Uni-app: AES Encrypt

来自Silica Library | 間奏時光
跳到导航 跳到搜索


// AES Encrypt
const encrypted = CryptoJS.AES.encrypt(
 CryptoJS.enc.Utf8.parse(originPassword),
 CryptoJS.enc.Utf8.parse(key), {
  mode: CryptoJS.mode.ECB,
 });

// To Base64
const passwordEncrypted = CryptoJS.enc.Base64.stringify(encrypted.ciphertext);

console.log(passwordEncrypted);