nodejs -- base加密和解密

1:加密

var b = new Buffer('key1=value1&key2=value2').toString('base64');  //加密base64
                                            //a2V5MT12YWx1ZTEma2V5Mj12YWx1ZTI=


2:解密

var a=new Buffer("a2V5MT12YWx1ZTEma2V5Mj12YWx1ZTI=",'base64').toString();  //base64解码
                                                            //key1=value1&key2=value2


你可能感兴趣的:(nodejs)