Fork me on GitHub

JavsScript对密码进行Base64加密和Base64解密

const password = "hello";

// 进行Base64加密
let pwd64 = window.btoa(password);

console.log(pwd64); // 输出为 aGVsbG8=

// 进行解密
let oldPwd = window.atob(pwd64);

console.log(oldPwd); // 输出为 hello

 

posted @ 2020-09-15 11:50  元芳啊  阅读(211)  评论(0编辑  收藏  举报