下载链接:https://www.bootcdn.cn/jsencrypt/
使用方法:
1、引入jsencrypt
2、使用方法
// 加密公钥 const key = `xxxxxx`; function setEncrypt (msg) { //msg:需要加密的字符 const jsencrypt = new JSEncrypt() jsencrypt.setPublicKey(key) return jsencrypt.encrypt(msg)//得到经过加密后的字符 }
// 解密私钥 const privateKey = `---` // 解密 export function decrypt (msg) { let decrypt = new JSEncrypt() decrypt.setPrivateKey(privateKey) var decryptMsg = decrypt.decrypt(msg) return decryptMsg }
参考链接:https://www.cnblogs.com/hlweng-0207/p/12971180.html
最后小声哔哔一点:不知道为什么csdn上的人随便一个小问题都要积分都要钱,就比如这个Js的下载
标签:加密,decrypt,解密,JSEncrypt,msg,jsencrypt From: https://www.cnblogs.com/tangjie85/p/16731795.html