js实现base64编码与解码(原生js)

参考:https://www.cnblogs.com/YMaster/p/9496068.html

前台可以加密两次

针对 IE8 IE9 的兼容使用 polyfill
<!--[if IE]>
<script src="./base64-polyfill.js"></script>
<![endif]-->

// 使用方法
window.btoa(10086)

  

后台解密

// 解密js加密的base64
String id = request.getParameter("id");
BASE64Decoder decoder = new BASE64Decoder(); 
byte[] b = decoder.decodeBuffer(id); 
String str=  new String(b);

  

  

原文地址:https://www.cnblogs.com/zhangchs/p/13870944.html