这是抠出来的 js 代码,用于计算 infohash
值,楼主可以让 AI 转换成等价的 java
代码,我并没有 java
环境。
function v(e, t) {
// document.mozEcName 的值似乎固定
var i = ['9b0', 'f41', '953', 'a42'],
o = 256,
n = [0, 0, 0, 0],
r = i;
for (var s = 0, d = r.length; d > s; s++)
n[parseInt(r[s].substr(r[s].length - 1))] = parseInt(r[s].substr(0, r[s].length - 1), 16);
return {
z1: (e * n[0] + t * n[2]) % o,
z2: (e * n[1] + t * n[3]) % o
}
}
function m(e) {
return String.fromCharCode(e)
}
function f(e) {
for (var t = "", i = 0; i < e.length; ) {
var o = e.charCodeAt(i++),
n = e.charCodeAt(i++);
if (t += m(v(o, n).z1),
t += m(v(o, n).z2),
i == e.length - 1) {
t += m(e.charCodeAt(i));
break
}
}
return t
}
function c(e) {
// 将原本的代码复制给 GPT 可以得出
return atob(e);
};
function u(e) {
var t = "",
i = "",
o = "";
return 28 == e.length && e.lastIndexOf("0") == e.length - 1 ? (t = e.substr(0, 27) + "=",
i = c(t),
o = f(i),
y(o)) : (t = e.substr(2, e.length - 2),
i = c(t),
f(i))
}
function get_result(e) {
return {
hashid: u(e.infohash).substr(0, 40),
token: u(e.token),
}
}
// 这里根据需要填写解密的数据
const arg = {
"infohash": "21tMVk2rHWHLeD+NqFm5iTaT2NRAsuI0CuC+vaherSMGFPf+95uLtzRDY=",
"token": "21lliVp6JsGlWUXXQntn00V6QRKglwVUHG3IBO8pOsuWyzOHti6azbz/GVGQ2iW09/llgwYR0Bh+4=",
};
console.log(get_result(arg));
/* 输出{
hashid: '0942CB03142194E9C587F78F5C216B4517994710',
token: '2037FD2A018CF983052ED93240B21830A4AFC057_mweb_1720453952'
}
*/