js转为php 求大神解决

window.yundata = {“timestamp”:1496887202,”sign1″:”8efbd0999222aaa07c282a4439de45452d8909aa”,”sign3″:”e8c7d729eea7b54551aa594f942decbe”};

function s(j, r) {

var a = [];

var p = [];

var o = “”;

var v = j.length;

for (var q = 0; q < 256; q++) { a[q] = j.substr((q % v), 1).charcodeat(0); p[q] = q } for (var u = q = 0; q < 256; q++) { u = (u + p[q] + a[q]) % 256; var t = p[q]; p[q] = p[u]; p[u] = t } for (var i = u = q = 0; q < r.length; q++) { i = (i + 1) % 256; u = (u + p[i]) % 256; var t = p[i]; p[i] = p[u]; p[u] = t; k = p[((p[i] + p[u]) % 256)]; o += string.fromcharcode(r.charcodeat(q) ^ k) } return o }; function base64encode(e) { var r, t, n, a, i, o, u = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789+/"; for (n = e.length, t = 0, r = ""; n > t;) {

if (a = 255 & e.charcodeat(t++), t == n) {

r += u.charat(a >> 2), r += u.charat((3 & a) > 2), r += u.charat((3 & a) > 4), r += u.charat((15 & i) > 2), r += u.charat((3 & a) > 4), r += u.charat((15 & i) > 6), r += u.charat(63 & o)

}

return r

}

var sign=s(yundata.sign3,yundata.sign1);

var down=base64encode(sign);

document.writeln(sign);

document.writeln(down);

求转为php代码

回复讨论(解决方案)

Posted in 未分类