**已关闭。**此问题需要debugging details。当前不接受答案。
编辑问题以包含desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem。这将有助于其他人回答问题。
58分钟前关门了。
Improve this question
var number = '162d83e7270cb4b1bfd83d82f30507f7GR1234567AB00000A162d83e7270cb4b1bfd83d82f30507f7'
var result = check (number);
var check = function (s) {
function L(k, d) {
return (k << d) | (k >>> (32 - d));
}
function K(G, k) {
var I, d, F, H, x;
F = G & 2147483648;
H = k & 2147483648;
I = G & 1073741824;
d = k & 1073741824;
x = (G & 1073741823) + (k & 1073741823);
if (I & d) {
return x ^ 2147483648 ^ F ^ H;
}
if (I | d) {
if (x & 1073741824) {
return x ^ 3221225472 ^ F ^ H;
} else {
return x ^ 1073741824 ^ F ^ H;
}
} else {
return x ^ F ^ H;
}
}
function r(d, F, k) {
return (d & F) | (~d & k);
}
function q(d, F, k) {
return (d & k) | (F & ~k);
}
function p(d, F, k) {
return d ^ F ^ k;
}
function n(d, F, k) {
return F ^ (d | ~k);
}
function u(G, F, aa, Z, k, H, I) {
G = K(G, K(K(r(F, aa, Z), k), I));
return K(L(G, H), F);
}
function f(G, F, aa, Z, k, H, I) {
G = K(G, K(K(q(F, aa, Z), k), I));
return K(L(G, H), F);
}
function D(G, F, aa, Z, k, H, I) {
G = K(G, K(K(p(F, aa, Z), k), I));
return K(L(G, H), F);
}
function t(G, F, aa, Z, k, H, I) {
G = K(G, K(K(n(F, aa, Z), k), I));
return K(L(G, H), F);
}
function e(G) {
var Z;
var F = G.length;
var x = F + 8;
var k = (x - (x % 64)) / 64;
var I = (k + 1) * 16;
var aa = Array(I - 1);
var d = 0;
var H = 0;
while (H < F) {
Z = (H - (H % 4)) / 4;
d = (H % 4) * 8;
aa[Z] = aa[Z] | (G.charCodeAt(H) << d);
H++;
}
Z = (H - (H % 4)) / 4;
d = (H % 4) * 8;
aa[Z] = aa[Z] | (128 << d);
aa[I - 2] = F << 3;
aa[I - 1] = F >>> 29;
return aa;
}
function B(x) {
var k = "",
F = "",
G,
d;
for (d = 0; d <= 3; d++) {
G = (x >>> (d * 8)) & 255;
F = "0" + G.toString(16);
k = k + F.substr(F.length - 2, 2);
}
return k;
}
function J(k) {
k = k.replace(/rn/g, "n");
var d = "";
for (var F = 0; F < k.length; F++) {
var x = k.charCodeAt(F);
if (x < 128) {
d += String.fromCharCode(x);
} else {
if (x > 127 && x < 2048) {
d += String.fromCharCode((x >> 6) | 192);
d += String.fromCharCode((x & 63) | 128);
} else {
d += String.fromCharCode((x >> 12) | 224);
d += String.fromCharCode(((x >> 6) & 63) | 128);
d += String.fromCharCode((x & 63) | 128);
}
}
}
return d;
}
var C = Array();
var P, h, E, v, g, Y, X, W, V;
var S = 7,
Q = 12,
N = 17,
M = 22;
var A = 5,
z = 9,
y = 14,
w = 20;
var o = 4,
m = 11,
l = 16,
j = 23;
var U = 6,
T = 10,
R = 15,
O = 21;
s = J(s);
C = e(s);
Y = 1732584193;
X = 4023233417;
W = 2562383102;
V = 271733878;
for (P = 0; P < C.length; P += 16) {
h = Y;
E = X;
v = W;
g = V;
Y = u(Y, X, W, V, C[P + 0], S, 3614090360);
V = u(V, Y, X, W, C[P + 1], Q, 3905402710);
W = u(W, V, Y, X, C[P + 2], N, 606105819);
X = u(X, W, V, Y, C[P + 3], M, 3250441966);
Y = u(Y, X, W, V, C[P + 4], S, 4118548399);
V = u(V, Y, X, W, C[P + 5], Q, 1200080426);
W = u(W, V, Y, X, C[P + 6], N, 2821735955);
X = u(X, W, V, Y, C[P + 7], M, 4249261313);
Y = u(Y, X, W, V, C[P + 8], S, 1770035416);
V = u(V, Y, X, W, C[P + 9], Q, 2336552879);
W = u(W, V, Y, X, C[P + 10], N, 4294925233);
X = u(X, W, V, Y, C[P + 11], M, 2304563134);
Y = u(Y, X, W, V, C[P + 12], S, 1804603682);
V = u(V, Y, X, W, C[P + 13], Q, 4254626195);
W = u(W, V, Y, X, C[P + 14], N, 2792965006);
X = u(X, W, V, Y, C[P + 15], M, 1236535329);
Y = f(Y, X, W, V, C[P + 1], A, 4129170786);
V = f(V, Y, X, W, C[P + 6], z, 3225465664);
W = f(W, V, Y, X, C[P + 11], y, 643717713);
X = f(X, W, V, Y, C[P + 0], w, 3921069994);
Y = f(Y, X, W, V, C[P + 5], A, 3593408605);
V = f(V, Y, X, W, C[P + 10], z, 38016083);
W = f(W, V, Y, X, C[P + 15], y, 3634488961);
X = f(X, W, V, Y, C[P + 4], w, 3889429448);
Y = f(Y, X, W, V, C[P + 9], A, 568446438);
V = f(V, Y, X, W, C[P + 14], z, 3275163606);
W = f(W, V, Y, X, C[P + 3], y, 4107603335);
X = f(X, W, V, Y, C[P + 8], w, 1163531501);
Y = f(Y, X, W, V, C[P + 13], A, 2850285829);
V = f(V, Y, X, W, C[P + 2], z, 4243563512);
W = f(W, V, Y, X, C[P + 7], y, 1735328473);
X = f(X, W, V, Y, C[P + 12], w, 2368359562);
Y = D(Y, X, W, V, C[P + 5], o, 4294588738);
V = D(V, Y, X, W, C[P + 8], m, 2272392833);
W = D(W, V, Y, X, C[P + 11], l, 1839030562);
X = D(X, W, V, Y, C[P + 14], j, 4259657740);
Y = D(Y, X, W, V, C[P + 1], o, 2763975236);
V = D(V, Y, X, W, C[P + 4], m, 1272893353);
W = D(W, V, Y, X, C[P + 7], l, 4139469664);
X = D(X, W, V, Y, C[P + 10], j, 3200236656);
Y = D(Y, X, W, V, C[P + 13], o, 681279174);
V = D(V, Y, X, W, C[P + 0], m, 3936430074);
W = D(W, V, Y, X, C[P + 3], l, 3572445317);
X = D(X, W, V, Y, C[P + 6], j, 76029189);
Y = D(Y, X, W, V, C[P + 9], o, 3654602809);
V = D(V, Y, X, W, C[P + 12], m, 3873151461);
W = D(W, V, Y, X, C[P + 15], l, 530742520);
X = D(X, W, V, Y, C[P + 2], j, 3299628645);
Y = t(Y, X, W, V, C[P + 0], U, 4096336452);
V = t(V, Y, X, W, C[P + 7], T, 1126891415);
W = t(W, V, Y, X, C[P + 14], R, 2878612391);
X = t(X, W, V, Y, C[P + 5], O, 4237533241);
Y = t(Y, X, W, V, C[P + 12], U, 1700485571);
V = t(V, Y, X, W, C[P + 3], T, 2399980690);
W = t(W, V, Y, X, C[P + 10], R, 4293915773);
X = t(X, W, V, Y, C[P + 1], O, 2240044497);
Y = t(Y, X, W, V, C[P + 8], U, 1873313359);
V = t(V, Y, X, W, C[P + 15], T, 4264355552);
W = t(W, V, Y, X, C[P + 6], R, 2734768916);
X = t(X, W, V, Y, C[P + 13], O, 1309151649);
Y = t(Y, X, W, V, C[P + 4], U, 4149444226);
V = t(V, Y, X, W, C[P + 11], T, 3174756917);
W = t(W, V, Y, X, C[P + 2], R, 718787259);
X = t(X, W, V, Y, C[P + 9], O, 3951481745);
Y = K(Y, h);
X = K(X, E);
W = K(W, v);
V = K(V, g);
}
var i = B(Y) + B(X) + B(W) + B(V);
return i.toLowerCase();
};
这是我的JS代码。我试着把JS代码转换成php,这是结果。
<?php
$number = "162d83e7270cb4b1bfd83d82f30507f7GR1234567AB00000A162d83e7270cb4b1bfd83d82f30507f7";
$result = call($check, $number);
$check = new Func(function($s = null) use (&$Array, &$String) {
$L = new Func("L", function($k = null, $d = null) {
return to_number($k) << to_number($d) | _bitwise_zfrs($k, 32.0 - to_number($d));
});
$K = new Func("K", function($G = null, $k = null) {
$F = to_number($G) & 2147483648.0;
$H = to_number($k) & 2147483648.0;
$I = to_number($G) & 1073741824.0;
$d = to_number($k) & 1073741824.0;
$x = _plus((to_number($G) & 1073741823.0), (to_number($k) & 1073741823.0));
if (is(to_number($I) & to_number($d))) {
return to_number($x) ^ 2147483648.0 ^ to_number($F) ^ to_number($H);
}
if (is(to_number($I) | to_number($d))) {
if (is(to_number($x) & 1073741824.0)) {
return to_number($x) ^ 3221225472.0 ^ to_number($F) ^ to_number($H);
} else {
return to_number($x) ^ 1073741824.0 ^ to_number($F) ^ to_number($H);
}
} else {
return to_number($x) ^ to_number($F) ^ to_number($H);
}
});
$r = new Func("r", function($d = null, $F = null, $k = null) {
return to_number($d) & to_number($F) | ~to_number($d) & to_number($k);
});
$q = new Func("q", function($d = null, $F = null, $k = null) {
return to_number($d) & to_number($k) | to_number($F) & ~to_number($k);
});
$p = new Func("p", function($d = null, $F = null, $k = null) {
return to_number($d) ^ to_number($F) ^ to_number($k);
});
$n = new Func("n", function($d = null, $F = null, $k = null) {
return to_number($F) ^ (to_number($d) | ~to_number($k));
});
$u = new Func("u", function($G = null, $F = null, $aa = null, $Z = null, $k = null, $H = null, $I = null) use (&$K, &$r, &$L) {
$G = call($K, $G, call($K, call($K, call($r, $F, $aa, $Z), $k), $I));
return call($K, call($L, $G, $H), $F);
});
$f = new Func("f", function($G = null, $F = null, $aa = null, $Z = null, $k = null, $H = null, $I = null) use (&$K, &$q, &$L) {
$G = call($K, $G, call($K, call($K, call($q, $F, $aa, $Z), $k), $I));
return call($K, call($L, $G, $H), $F);
});
$D = new Func("D", function($G = null, $F = null, $aa = null, $Z = null, $k = null, $H = null, $I = null) use (&$K, &$p, &$L) {
$G = call($K, $G, call($K, call($K, call($p, $F, $aa, $Z), $k), $I));
return call($K, call($L, $G, $H), $F);
});
$t = new Func("t", function($G = null, $F = null, $aa = null, $Z = null, $k = null, $H = null, $I = null) use (&$K, &$n, &$L) {
$G = call($K, $G, call($K, call($K, call($n, $F, $aa, $Z), $k), $I));
return call($K, call($L, $G, $H), $F);
});
$e = new Func("e", function($G = null) use (&$Array) {
$F = get($G, "length");
$x = _plus($F, 8.0);
$k = _divide((to_number($x) - (float)(to_number($x) % 64.0)), 64.0);
$I = to_number(_plus($k, 1.0)) * 16.0;
$aa = call($Array, to_number($I) - 1.0);
$d = 0.0;
$H = 0.0;
while ($H < $F) {
$Z = _divide((to_number($H) - (float)(to_number($H) % 4.0)), 4.0);
$d = (float)(to_number($H) % 4.0) * 8.0;
set($aa, $Z, to_number(get($aa, $Z)) | to_number(call_method($G, "charCodeAt", $H)) << to_number($d));
$H++;
}
$Z = _divide((to_number($H) - (float)(to_number($H) % 4.0)), 4.0);
$d = (float)(to_number($H) % 4.0) * 8.0;
set($aa, $Z, to_number(get($aa, $Z)) | 128.0 << to_number($d));
set($aa, to_number($I) - 2.0, to_number($F) << 3.0);
set($aa, to_number($I) - 1.0, _bitwise_zfrs($F, 29.0));
return $aa;
});
$B = new Func("B", function($x = null) {
$k = ""; $F = "";
for ($d = 0.0; $d <= 3.0; $d++) {
$G = _bitwise_zfrs($x, to_number($d) * 8.0) & 255.0;
$F = _concat("0", call_method($G, "toString", 16.0));
$k = _plus($k, call_method($F, "substr", to_number(get($F, "length")) - 2.0, 2.0));
}
return $k;
});
$J = new Func("J", function($k = null) use (&$String) {
$k = call_method($k, "replace", new RegExp("rn", "g"), "n");
$d = "";
for ($F = 0.0; $F < get($k, "length"); $F++) {
$x = call_method($k, "charCodeAt", $F);
if ($x < 128.0) {
$d = _plus($d, call_method($String, "fromCharCode", $x));
} else {
if ($x > 127.0 && $x < 2048.0) {
$d = _plus($d, call_method($String, "fromCharCode", to_number($x) >> 6.0 | 192.0));
$d = _plus($d, call_method($String, "fromCharCode", to_number($x) & 63.0 | 128.0));
} else {
$d = _plus($d, call_method($String, "fromCharCode", to_number($x) >> 12.0 | 224.0));
$d = _plus($d, call_method($String, "fromCharCode", to_number($x) >> 6.0 & 63.0 | 128.0));
$d = _plus($d, call_method($String, "fromCharCode", to_number($x) & 63.0 | 128.0));
}
}
}
return $d;
});
$C = call($Array);
$S = 7.0; $Q = 12.0; $N = 17.0; $M = 22.0;
$A = 5.0; $z = 9.0; $y = 14.0; $w = 20.0;
$o = 4.0; $m = 11.0; $l = 16.0; $j = 23.0;
$U = 6.0; $T = 10.0; $R = 15.0; $O = 21.0;
$s = call($J, $s);
$C = call($e, $s);
$Y = 1732584193.0;
$X = 4023233417.0;
$W = 2562383102.0;
$V = 271733878.0;
for ($P = 0.0; $P < get($C, "length"); $P = _plus($P, 16.0)) {
$h = $Y;
$E = $X;
$v = $W;
$g = $V;
$Y = call($u, $Y, $X, $W, $V, get($C, _plus($P, 0.0)), $S, 3614090360.0);
$V = call($u, $V, $Y, $X, $W, get($C, _plus($P, 1.0)), $Q, 3905402710.0);
$W = call($u, $W, $V, $Y, $X, get($C, _plus($P, 2.0)), $N, 606105819.0);
$X = call($u, $X, $W, $V, $Y, get($C, _plus($P, 3.0)), $M, 3250441966.0);
$Y = call($u, $Y, $X, $W, $V, get($C, _plus($P, 4.0)), $S, 4118548399.0);
$V = call($u, $V, $Y, $X, $W, get($C, _plus($P, 5.0)), $Q, 1200080426.0);
$W = call($u, $W, $V, $Y, $X, get($C, _plus($P, 6.0)), $N, 2821735955.0);
$X = call($u, $X, $W, $V, $Y, get($C, _plus($P, 7.0)), $M, 4249261313.0);
$Y = call($u, $Y, $X, $W, $V, get($C, _plus($P, 8.0)), $S, 1770035416.0);
$V = call($u, $V, $Y, $X, $W, get($C, _plus($P, 9.0)), $Q, 2336552879.0);
$W = call($u, $W, $V, $Y, $X, get($C, _plus($P, 10.0)), $N, 4294925233.0);
$X = call($u, $X, $W, $V, $Y, get($C, _plus($P, 11.0)), $M, 2304563134.0);
$Y = call($u, $Y, $X, $W, $V, get($C, _plus($P, 12.0)), $S, 1804603682.0);
$V = call($u, $V, $Y, $X, $W, get($C, _plus($P, 13.0)), $Q, 4254626195.0);
$W = call($u, $W, $V, $Y, $X, get($C, _plus($P, 14.0)), $N, 2792965006.0);
$X = call($u, $X, $W, $V, $Y, get($C, _plus($P, 15.0)), $M, 1236535329.0);
$Y = call($f, $Y, $X, $W, $V, get($C, _plus($P, 1.0)), $A, 4129170786.0);
$V = call($f, $V, $Y, $X, $W, get($C, _plus($P, 6.0)), $z, 3225465664.0);
$W = call($f, $W, $V, $Y, $X, get($C, _plus($P, 11.0)), $y, 643717713.0);
$X = call($f, $X, $W, $V, $Y, get($C, _plus($P, 0.0)), $w, 3921069994.0);
$Y = call($f, $Y, $X, $W, $V, get($C, _plus($P, 5.0)), $A, 3593408605.0);
$V = call($f, $V, $Y, $X, $W, get($C, _plus($P, 10.0)), $z, 38016083.0);
$W = call($f, $W, $V, $Y, $X, get($C, _plus($P, 15.0)), $y, 3634488961.0);
$X = call($f, $X, $W, $V, $Y, get($C, _plus($P, 4.0)), $w, 3889429448.0);
$Y = call($f, $Y, $X, $W, $V, get($C, _plus($P, 9.0)), $A, 568446438.0);
$V = call($f, $V, $Y, $X, $W, get($C, _plus($P, 14.0)), $z, 3275163606.0);
$W = call($f, $W, $V, $Y, $X, get($C, _plus($P, 3.0)), $y, 4107603335.0);
$X = call($f, $X, $W, $V, $Y, get($C, _plus($P, 8.0)), $w, 1163531501.0);
$Y = call($f, $Y, $X, $W, $V, get($C, _plus($P, 13.0)), $A, 2850285829.0);
$V = call($f, $V, $Y, $X, $W, get($C, _plus($P, 2.0)), $z, 4243563512.0);
$W = call($f, $W, $V, $Y, $X, get($C, _plus($P, 7.0)), $y, 1735328473.0);
$X = call($f, $X, $W, $V, $Y, get($C, _plus($P, 12.0)), $w, 2368359562.0);
$Y = call($D, $Y, $X, $W, $V, get($C, _plus($P, 5.0)), $o, 4294588738.0);
$V = call($D, $V, $Y, $X, $W, get($C, _plus($P, 8.0)), $m, 2272392833.0);
$W = call($D, $W, $V, $Y, $X, get($C, _plus($P, 11.0)), $l, 1839030562.0);
$X = call($D, $X, $W, $V, $Y, get($C, _plus($P, 14.0)), $j, 4259657740.0);
$Y = call($D, $Y, $X, $W, $V, get($C, _plus($P, 1.0)), $o, 2763975236.0);
$V = call($D, $V, $Y, $X, $W, get($C, _plus($P, 4.0)), $m, 1272893353.0);
$W = call($D, $W, $V, $Y, $X, get($C, _plus($P, 7.0)), $l, 4139469664.0);
$X = call($D, $X, $W, $V, $Y, get($C, _plus($P, 10.0)), $j, 3200236656.0);
$Y = call($D, $Y, $X, $W, $V, get($C, _plus($P, 13.0)), $o, 681279174.0);
$V = call($D, $V, $Y, $X, $W, get($C, _plus($P, 0.0)), $m, 3936430074.0);
$W = call($D, $W, $V, $Y, $X, get($C, _plus($P, 3.0)), $l, 3572445317.0);
$X = call($D, $X, $W, $V, $Y, get($C, _plus($P, 6.0)), $j, 76029189.0);
$Y = call($D, $Y, $X, $W, $V, get($C, _plus($P, 9.0)), $o, 3654602809.0);
$V = call($D, $V, $Y, $X, $W, get($C, _plus($P, 12.0)), $m, 3873151461.0);
$W = call($D, $W, $V, $Y, $X, get($C, _plus($P, 15.0)), $l, 530742520.0);
$X = call($D, $X, $W, $V, $Y, get($C, _plus($P, 2.0)), $j, 3299628645.0);
$Y = call($t, $Y, $X, $W, $V, get($C, _plus($P, 0.0)), $U, 4096336452.0);
$V = call($t, $V, $Y, $X, $W, get($C, _plus($P, 7.0)), $T, 1126891415.0);
$W = call($t, $W, $V, $Y, $X, get($C, _plus($P, 14.0)), $R, 2878612391.0);
$X = call($t, $X, $W, $V, $Y, get($C, _plus($P, 5.0)), $O, 4237533241.0);
$Y = call($t, $Y, $X, $W, $V, get($C, _plus($P, 12.0)), $U, 1700485571.0);
$V = call($t, $V, $Y, $X, $W, get($C, _plus($P, 3.0)), $T, 2399980690.0);
$W = call($t, $W, $V, $Y, $X, get($C, _plus($P, 10.0)), $R, 4293915773.0);
$X = call($t, $X, $W, $V, $Y, get($C, _plus($P, 1.0)), $O, 2240044497.0);
$Y = call($t, $Y, $X, $W, $V, get($C, _plus($P, 8.0)), $U, 1873313359.0);
$V = call($t, $V, $Y, $X, $W, get($C, _plus($P, 15.0)), $T, 4264355552.0);
$W = call($t, $W, $V, $Y, $X, get($C, _plus($P, 6.0)), $R, 2734768916.0);
$X = call($t, $X, $W, $V, $Y, get($C, _plus($P, 13.0)), $O, 1309151649.0);
$Y = call($t, $Y, $X, $W, $V, get($C, _plus($P, 4.0)), $U, 4149444226.0);
$V = call($t, $V, $Y, $X, $W, get($C, _plus($P, 11.0)), $T, 3174756917.0);
$W = call($t, $W, $V, $Y, $X, get($C, _plus($P, 2.0)), $R, 718787259.0);
$X = call($t, $X, $W, $V, $Y, get($C, _plus($P, 9.0)), $O, 3951481745.0);
$Y = call($K, $Y, $h);
$X = call($K, $X, $E);
$W = call($K, $W, $v);
$V = call($K, $V, $g);
}
$i = _plus(call($B, $Y), call($B, $X), call($B, $W), call($B, $V));
return call_method($i, "toLowerCase");
});
?>
但是,它没有给出想要的输出。有人能检查一下是什么错误吗?有人能修复它吗?我是新来的php,我不知道很多关于它。我试图转换JS代码到我的赌注可能的理解。
1条答案
按热度按时间ngynwnxp1#
我不想看完你的全部代码,但也许你可以试试这样的工具:https://wtools.io/javascript-to-php-converter