8.7w+
社区成员
function getEncryption(password, salt, vcode, isMd5) {
vcode = vcode || "";
password = password || "";
var md5Pwd = isMd5 ? password : md5(password),
h1 = hexchar2bin(md5Pwd),
s2 = md5(h1 + salt),
rsaH1 = $pt.RSA.rsa_encrypt(h1),
rsaH1Len = (rsaH1.length / 2).toString(16),
hexVcode = TEA.strToBytes(vcode.toUpperCase(), true),
vcodeLen = Number(hexVcode.length / 2).toString(16);
while (vcodeLen.length < 4) {
vcodeLen = "0" + vcodeLen
}
while (rsaH1Len.length < 4) {
rsaH1Len = "0" + rsaH1Len
}
TEA.initkey(s2);
var saltPwd = TEA.enAsBase64(rsaH1Len + rsaH1 + TEA.strToBytes(salt) + vcodeLen + hexVcode);
TEA.initkey("");
setTimeout(function() {
__monitor(488358, 1)
}, 0);
return saltPwd.replace(/[\/\+=]/g, function(a) {
return {
"/": "-",
"+": "*",
"=": "_"
}[a]
})
}
<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript">
function show()
{
str = getEncryption("123123","\x00\x00\x00\x00\x22\xcd\xaf\x37","!XVP",1);
alert(str);
}
</script>
</head>
<body>
<script src="mq_comm.js"></script>
<button onclick="show()">Show me</button>
</body>
</html>