ticket-py/yes24Global/aes.js
2024-04-30 17:47:01 +08:00

108 lines
3.1 KiB
JavaScript

extend = function (a) {
var b = this;
return a && b.mixIn(a),
b.hasOwnProperty("init") || (b.init = function () {
b.$super.init.apply(this, arguments)
}
),
b.init.prototype = b,
b.$super = this,
b
}
init = function (a, c) {
a = this.words = a || [],
this.sigBytes = c != 1 ? c : 4 * a.length
}
random = function (b) {
for (var c = [], d = 0; b > d; d += 4)
c.push(4294967296 * a.random() | 0);
return new init(c, b)
}
create = function () {
var a = this.extend();
return a.init.apply(a, arguments),
a
}
init = function (a, c) {
a = this.words = a || [],
this.sigBytes = c != undefined ? c : 4 * a.length
}
parse = function (a) {
for (var b = a.length, c = [], d = 0; b > d; d += 2)
c[d >>> 3] |= parseInt(a.substr(d, 2), 16) << 24 - 4 * (d % 8);
return init(c, b / 2)
}
encrypt = function (b, c, d) {
return ("string" == typeof c ? o : n).encrypt(a, b, c, d)
}
encryptAES128 = function (a) {
var b, c, d, e = function (a) {
for (var b = random(1), c = 0; 4 > c; c++)
b.words.push(a.key.words[c]);
return b.words.push(random(1).words[0]),
b.sigBytes = 24,
a.ciphertext.words = b.words.concat(a.ciphertext.words),
a.ciphertext.sigBytes = 4 * a.ciphertext.words.length,
"" + a
}, f = (new Date).getTime(), g = [489824794, 124536943, -1636233340, 611703768],
h = new Array(33).join("x").replace(/[x]/g, function (a) {
var b = (f + 16 * Math.random()) % 16 | 0;
return f = Math.floor(f / 16),
("x" == a ? b : 3 & b | 8).toString(16)
});
return b = create([-955889956, 2144910020, -575943600, -968486662]),
c = create(g),
d = encrypt(a, b, {
iv: c
}),
e(d)
}
a = {
"101": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36",
"102": "Google Inc.",
"103": "",
"105": "true",
"106": "Netscape",
"107": "Mozilla",
"108": "5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36",
"110": "Gecko",
"111": "false",
"112": "true",
"201": "Win32",
"203": "zh-CN",
"204": -480,
"205": "8efedc8c82d76c74927fb3706d6f39b7e36a19c58e52bec3b558f415fd536c14",
"301": 1707,
"302": 1707,
"303": 960,
"304": 912,
"305": 96,
"306": 127,
"307": 1011,
"308": 727,
"309": 0,
"310": 0,
"311": 0,
"312": 0,
"313": 24,
"314": 24,
"315": 1.5,
"401": "PDF Viewer,Chrome PDF Viewer,Chromium PDF Viewer,Microsoft Edge PDF Viewer,WebKit built-in PDF",
"501": "157.254.193.43",
"601": "04f0108911d94381b9676e7640712db4",
"602": "ff13d5388d9c79156e00d1396f06f615607ce41ca3db825143503dfcb302886e",
"604": "false",
"605": "fe13ccfb9cdcab623701c1fa821ae99197e28d4a317d0848ce4b2a2e89bddc54",
"606": "exist",
"607": "false"
}
console.log(encryptAES128(JSON.stringify(a)))