Files
tulin-code/非对称加密-2026-09-02/实战案例-五矿集团/五矿集团.js
Whale-Fall-Code 418a0411d1 Initialize encryption and JavaScript reverse-engineering study repository
Document the project structure and setup while excluding local dependencies and IDE settings.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-09 23:25:05 +08:00

103 lines
3.0 KiB
JavaScript

var JSEncrypt = require("jsencrypt");
var crypto_js = require("crypto-js");
function w(A) {
var e, t, n = "", r = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", a = "=";
for (e = 0; e + 3 <= A.length; e += 3)
t = parseInt(A.substring(e, e + 3), 16),
n += r.charAt(t >> 6) + r.charAt(63 & t);
e + 1 == A.length ? (t = parseInt(A.substring(e, e + 1), 16),
n += r.charAt(t << 2)) : e + 2 == A.length && (t = parseInt(A.substring(e, e + 2), 16),
n += r.charAt(t >> 2) + r.charAt((3 & t) << 4));
while ((3 & n.length) > 0)
n += a;
return n
}
function encryptLong(jsencrypt_object, A) {
var e = jsencrypt_object.getKey()
, t = (e.n.bitLength() + 7 >> 3) - 11;
try {
var n = ""
, r = "";
if (A.length > t)
return n = A.match(/.{1,50}/g),
n.forEach((function (A) {
var t = e.encrypt(A);
r += t
}
)),
w(r);
var a = e.encrypt(A)
, s = w(a);
return s
} catch (i) {
return i
}
}
function v(A, e) {
var t = Object.keys(A);
if (Object.getOwnPropertySymbols) {
var n = Object.getOwnPropertySymbols(A);
e && (n = n.filter((function (e) {
return Object.getOwnPropertyDescriptor(A, e).enumerable
}
))),
t.push.apply(t, n)
}
return t
}
function encode_MD5(data) {
return crypto_js.MD5(data).toString()
}
function m(A) {
for (var e = 1; e < arguments.length; e++) {
var t = null != arguments[e] ? arguments[e] : {};
e % 2 ? v(Object(t), !0).forEach((function (e) {
b(A, e, t[e])
}
)) : Object.getOwnPropertyDescriptors ? Object.defineProperties(A, Object.getOwnPropertyDescriptors(t)) : v(Object(t)).forEach((function (e) {
Object.defineProperty(A, e, Object.getOwnPropertyDescriptor(t, e))
}
))
}
return A
}
function b(A, e, t) {
return e in A ? Object.defineProperty(A, e, {
value: t,
enumerable: !0,
configurable: !0,
writable: !0
}) : A[e] = t,
A
}
function encrypt_param(public_key, page) {
var r = public_key;
var t = new JSEncrypt();
t.setPublicKey(r);
var e = {
"inviteMethod": "",
"businessClassfication": "",
"mc": "",
"lx": "ZBGG",
"dwmc": "",
"pageIndex": page
};
a = m(m({}, e), {}, {
sign: encode_MD5(JSON.stringify(e)),
timeStamp: +new Date
});
return encryptLong(t, JSON.stringify(a))
}
// var key = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrD7FHuUUHUCWeInEnnRraglf7ytCal3jB4bP66T7vkUQZRepM1uNr1LWucdPMYvDsaN8LSsu8HHwoqqRoQx33T5pNrFWe4/daccjbM7m7h8VWRQ2Ny3rgRNuSIIg012o25ORgpAHjGBXQ+mMzFYvCFYzY6sKMmqS3k0xYpy6KwwIDAQAB";
// console.log(new JSEncrypt().__proto__)
// console.log(encrypt_param(key, 0))