前端非中文大字符串加密:
JSEncrypt.prototype.encryptLong = function(string) {
var k = this.getKey();
var maxLength = (((k.n.bitLength()+7)>>3)-11);
// var maxLength = 117;
try {
var lt = "";
var ct = "";
if (string.length > maxLength) {
lt = string.match(/.{1,117}/g);
lt.forEach(function(entry) {
var t1 = k.encrypt(entry);
ct += t1 ;
console.log("每一次:"+ct);
});
return hex2b64(ct);
}else{
console.log("失败"+string.length);
}
var t = k.encrypt(string);
var y = hex2b64(t);
return y;
} catch (ex) {
return false;
}
};