/**
* JS加密解密类
* author:a7
*/
var PWUtil=function (){
this.key = "19-45896521-88-57125675-0603";//加密解密钥匙(重要)
this.klen = this.key.len;
/**
*加密方法
*@param pas 明文
*/
this.encode=function(pas){
alert(pas);
var ps = "";
var e = "";
//加密
for(var i=0;i<pas.length;i++){
var d = pas[i];
var c = this.key[i];
e = d^c;
if(d > 9 || d < 0){
e = d&0x07;
}else{
e = d^c;
}
/*转换成数值前,保证最高位非0*/
if(i==0 && e==0){
e = 2;
}
if(i==pas.length/2 && e==0){
e = 6;
}
ps+=e;
//ps+=String.fromCharCode(d^c);
}
alert(ps);
var data1 = "";
var data2 = "";
var j = 0;
//alert("ps"+ps);
var stringArray = ps.split("");
while(j < (stringArray.length/2)){
data1 += stringArray[j];
data2 += stringArray[j+stringArray.length/2];
j++;
}
alert("dataOne"+data1);
alert("dataTwo"+data2);
var decData1 = data1&data2;
var decData2 = data1^data2;
var result = decData1+""+decData2;
return result;
}
}
* JS加密解密类
* author:a7
*/
var PWUtil=function (){
this.key = "19-45896521-88-57125675-0603";//加密解密钥匙(重要)
this.klen = this.key.len;
/**
*加密方法
*@param pas 明文
*/
this.encode=function(pas){
alert(pas);
var ps = "";
var e = "";
//加密
for(var i=0;i<pas.length;i++){
var d = pas[i];
var c = this.key[i];
e = d^c;
if(d > 9 || d < 0){
e = d&0x07;
}else{
e = d^c;
}
/*转换成数值前,保证最高位非0*/
if(i==0 && e==0){
e = 2;
}
if(i==pas.length/2 && e==0){
e = 6;
}
ps+=e;
//ps+=String.fromCharCode(d^c);
}
alert(ps);
var data1 = "";
var data2 = "";
var j = 0;
//alert("ps"+ps);
var stringArray = ps.split("");
while(j < (stringArray.length/2)){
data1 += stringArray[j];
data2 += stringArray[j+stringArray.length/2];
j++;
}
alert("dataOne"+data1);
alert("dataTwo"+data2);
var decData1 = data1&data2;
var decData2 = data1^data2;
var result = decData1+""+decData2;
return result;
}
}