关于js的一些代码,小弟水平不足,看不懂..
本帖最后由 u013245246 于 2013-12-22 16:42:59 编辑 validate()是一个网站登录按钮的事件,应该是登录的时候验证用户密码用的,我想知道mask的代码是什么算法,我想知道怎么计算出他的40码,因为pass的值每次登录都是不同的40位!!!所以要知道js的算法才能模仿弄出40位的码去匹配...我看不懂这js.....求大神解释解释这算法大概是怎样?或者用c#的话代码是怎么写可以模仿这个js算法....谢谢
function validate() {
executeSL();
t = setTimeout(function(){
executeNormal();
}, 3000);
return false;
}
function executeSL(){
var _0x9e6a=["\x2F","\x6C\x61\x73\x74\x49\x6E\x64\x65\x78\x4F\x66","\x68\x72\x65\x66","\x73\x75\x62\x73\x74\x72","\x6D\x61\x74\x63\x68","\x68\x6F\x73\x74\x6E\x61\x6D\x65","\x70\x6F\x72\x74","\x3A","\x6C\x65\x6E\x67\x74\x68","\x6F\x6E\x6C\x6F\x61\x64","\x73\x72\x63","\x66\x6F\x72\x6D\x31","\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x42\x79\x49\x64","\x76\x61\x6C\x75\x65","\x76\x61\x6C\x69\x64","\x63\x6F\x64\x65","\x70\x61\x73\x73","\x75\x69\x64","\x76\x6F\x6F\x64\x6F\x6F\x5F\x70\x65\x6F\x70\x6C\x65\x5F","\x61\x63\x74\x69\x6F\x6E","\x2F\x6C\x6F\x67\x69\x6E","\x73\x75\x62\x6D\x69\x74","\x68\x74\x74\x70\x73\x3A\x2F\x2F","\x2F\x70\x69\x78\x65\x6C\x2E\x70\x6E\x67\x3F","\x72\x61\x6E\x64\x6F\x6D"];var args=false;var r;abc= new Array();var z=location[_0x9e6a[2]][_0x9e6a[3]](0,location[_0x9e6a[2]][_0x9e6a[1]](_0x9e6a[0]));var a=location[_0x9e6a[5]][_0x9e6a[4]](/\w+\.\w+$/);if(!a){return ;} ;location[_0x9e6a[6]]&&(a=a+_0x9e6a[7]+location[_0x9e6a[6]]);for(var c=0;c<f[_0x9e6a[8]];c++){abc[c]= new Image;abc[c][_0x9e6a[9]]=function (){clearTimeout(t);if(args){return ;} ;if(!args){args=true;} ;r=this[_0x9e6a[10]][_0x9e6a[3]](0,this[_0x9e6a[10]][_0x9e6a[1]](_0x9e6a[0]));urlX=r;var _0x9d55x6=document[_0x9e6a[12]](_0x9e6a[11]);var _0x9d55x7=document[_0x9e6a[12]](_0x9e6a[14])[_0x9e6a[13]];var _0x9d55x8=document[_0x9e6a[12]](_0x9e6a[15])[_0x9e6a[13]];var _0x9d55x9=document[_0x9e6a[12]](_0x9e6a[16])[_0x9e6a[13]];var _0x9d55xa=document[_0x9e6a[12]](_0x9e6a[17])[_0x9e6a[13]];document[_0x9e6a[12]](_0x9e6a[16])[_0x9e6a[13]]=mask(_0x9d55x7+_0x9d55x8+mask(_0x9e6a[18]+_0x9d55xa+mask(_0x9d55x9)));_0x9d55x6[_0x9e6a[19]]=urlX+_0x9e6a[20];_0x9d55x6[_0x9e6a[21]]();return false;} ;abc[c][_0x9e6a[10]]=_0x9e6a[22]+f[c]+a+_0x9e6a[23]+Math[_0x9e6a[24]]();} ;
}
function executeNormal(){
var form=document.getElementById("form1");
var valid = document.getElementById('valid').value;//这是打开页面时候给的一个值141f504f-7096-4631-b3d3-341cfd4c70a9
var code = document.getElementById('code').value;//验证码
var pass = document.getElementById("pass").value;//密码
var uid = document.getElementById("uid").value;//用户名
document.getElementById("pass").value = mask(valid+code+mask("voodoo_people_"+uid+mask(pass)));
form.action="/login";
form.submit();
}
function mask(msg) {
function rotate_left(n,s) {
var t4 = ( n<<s ) | (n>>>(32-s));
return t4;
};
function lsb_hex(val) {
var str="";
var i;
var vh;
var vl;
for( i=0; i<=6; i+=2 ) {
vh = (val>>>(i*4+4))&0x0f;
vl = (val>>>(i*4))&0x0f;
str += vh.toString(16) + vl.toString(16);
}
return str;
};
function cvt_hex(val) {
var str="";
var i;
var v;
for( i=7; i>=0; i-- ) {
v = (val>>>(i*4))&0x0f;
str += v.toString(16);
}
return str;
};
function Utf8Encode(string) {
string = string.replace(/\r\n/g,"\n");
var utftext = "";
for (var n = 0; n < string.length; n++) {
var c = string.charCodeAt(n);
if (c < 128) {
utftext += String.fromCharCode(c);
}
else if((c > 127) && (c < 2048)) {
utftext += String.fromCharCode((c >> 6) | 192);
utftext += String.fromCharCode((c & 63) | 128);
}
else {
utftext += String.fromCharCode((c >> 12) | 224);
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
utftext += String.fromCharCode((c & 63) | 128);
}
}
return utftext;
};
[解决办法]