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);