猿问

我想知道下面的JS是什么算法

<script>

var iv = 0xff;

function GetRequest() {

var url = location.search;

var theRequest = new Object();

if (url.indexOf("?") != -1) {

var str = url.substr(1);

strs = str.split("&");

for (var i = 0; i < strs.length; i++) {

theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1])

}

}

return theRequest

}

function enc(key, s, e) {

cipher = "";

for (i = 0; i < key.length; i++) {

k = (s + e) % iv;

t = e;

e = s + e;

s = t;

cipher += key[i] ^ k

}

if (cipher == "34558914423312210022264341011282361161032135513678115123012499") console.log("That's Right!");

else console.log("Something's Wrong!")

}

var Request = new Object();

Request = GetRequest();

console.log(Request);

enc(Request['key'], 13, 21); </script>


慕UI1458911
浏览 1625回答 1
1回答

林兴2021

给url地址后带的参数,用十进制字符串加密的一个算法
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答