const FIXED_KEY_TEXT = "49AV5584B3647FJ";
const IP = [
0x39, 0x31, 0x29, 0x21, 0x19, 0x11, 0x09, 0x01,
0x3B, 0x33, 0x2B, 0x23, 0x1B, 0x13, 0x0B, 0x03,
0x3D, 0x35, 0x2D, 0x25, 0x1D, 0x15, 0x0D, 0x05,
0x3F, 0x37, 0x2F, 0x27, 0x1F, 0x17, 0x0F, 0x07,
0x38, 0x30, 0x28, 0x20, 0x18, 0x10, 0x08, 0x00,
0x3A, 0x32, 0x2A, 0x22, 0x1A, 0x12, 0x0A, 0x02,
0x3C, 0x34, 0x2C, 0x24, 0x1C, 0x14, 0x0C, 0x04,
0x3E, 0x36, 0x2E, 0x26, 0x1E, 0x16, 0x0E, 0x06,
];
const FP = [
0x27, 0x07, 0x2F, 0x0F, 0x37, 0x17, 0x3F, 0x1F,
0x26, 0x06, 0x2E, 0x0E, 0x36, 0x16, 0x3E, 0x1E,
0x25, 0x05, 0x2D, 0x0D, 0x35, 0x15, 0x3D, 0x1D,
0x24, 0x04, 0x2C, 0x0C, 0x34, 0x14, 0x3C, 0x1C,
0x23, 0x03, 0x2B, 0x0B, 0x33, 0x13, 0x3B, 0x1B,
0x22, 0x02, 0x2A, 0x0A, 0x32, 0x12, 0x3A, 0x1A,
0x21, 0x01, 0x29, 0x09, 0x31, 0x11, 0x39, 0x19,
0x20, 0x00, 0x28, 0x08, 0x30, 0x10, 0x38, 0x18,
];
const PC1 = [
0x38, 0x30, 0x28, 0x20, 0x18, 0x10, 0x08, 0x00,
0x39, 0x31, 0x29, 0x21, 0x19, 0x11, 0x09, 0x01,
0x3A, 0x32, 0x2A, 0x22, 0x1A, 0x12, 0x0A, 0x02,
0x3B, 0x33, 0x2B, 0x23, 0x3E, 0x36, 0x2E, 0x26,
0x1E, 0x16, 0x0E, 0x06, 0x3D, 0x35, 0x2D, 0x25,
0x1D, 0x15, 0x0D, 0x05, 0x3C, 0x34, 0x2C, 0x24,
0x1C, 0x14, 0x0C, 0x04, 0x1B, 0x13, 0x0B, 0x03,
];
const PC2 = [
0x0D, 0x10, 0x0A, 0x17, 0x00, 0x04, 0x02, 0x1B,
0x0E, 0x05, 0x14, 0x09, 0x16, 0x12, 0x0B, 0x03,
0x19, 0x07, 0x0F, 0x06, 0x1A, 0x13, 0x0C, 0x01,
0x28, 0x33, 0x1E, 0x24, 0x2E, 0x36, 0x1D, 0x27,
0x32, 0x2C, 0x20, 0x2F, 0x2B, 0x30, 0x26, 0x37,
0x21, 0x34, 0x2D, 0x29, 0x31, 0x23, 0x1C, 0x1F,
];
const ROTATIONS = [1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1];
const E_EXPAND = [
31, 0, 1, 2, 3, 4, 3, 4, 5, 6, 7, 8,
7, 8, 9, 10, 11, 12, 11, 12, 13, 14, 15, 16,
15, 16, 17, 18, 19, 20, 19, 20, 21, 22, 23, 24,
23, 24, 25, 26, 27, 28, 27, 28, 29, 30, 31, 0,
];
// Non-standard P permutation (from byte_CD7B50)
const P_PERM = [
0x0F, 0x06, 0x13, 0x14, 0x05, 0x0B, 0x1B, 0x10,
0x00, 0x17, 0x16, 0x19, 0x04, 0x11, 0x1E, 0x09,
0x01, 0x07, 0x0E, 0x0D, 0x1F, 0x1A, 0x02, 0x08,
0x12, 0x0C, 0x1D, 0x1C, 0x15, 0x0A, 0x03, 0x18,
];
const S_BOXES = [
[
14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7,
0,15, 7, 4,14, 2, 13, 1,10, 6,12, 11, 9, 5, 3, 8,
4, 1, 14, 8,13, 6, 2,11,15, 12, 9, 7, 3,10, 5, 0,
15,12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14,10, 0, 6,13,
],
[
15, 1, 8,14, 6,11, 3, 4, 9, 7, 2,13,12, 0, 5,10,
3,13, 4, 7,15, 2, 8,14,12, 0, 1,10, 6, 9,11, 5,
0,14, 7,11,10, 4,13, 1, 5, 8,12, 6, 9, 3, 2,15,
13, 8,10, 1, 3,15, 4, 2,11, 6, 7,12, 0, 5,14, 9,
],
[
10, 0, 9,14, 6, 3,15, 5, 1,13,12, 7,11, 4, 2, 8,
13, 7, 0, 9, 3, 4, 6,10, 2, 8, 5,14,12,11,15, 1,
13, 6, 4, 9, 8,15, 3, 0,11, 1, 2,12, 5,10,14, 7,
1,10,13, 0, 6, 9, 8, 7, 4,15,14, 3,11, 5, 2,12,
],
[
7,13,14, 3, 0, 6, 9,10, 1, 2, 8, 5,11,12, 4,15,
13, 8,11, 5, 6,15, 0, 3, 4, 7, 2,12, 1,10,14, 9,
10, 6, 9, 0,12,11, 7,13,15, 1, 3,14, 5, 2, 8, 4,
3,15, 0, 6,10, 1,13, 8, 9, 4, 5,11,12, 7, 2,14,
],
[
2,12, 4, 1, 7,10,11, 6, 8, 5, 3,15,13, 0,14, 9,
14,11, 2,12, 4, 7,13, 1, 5, 0,15,10, 3, 9, 8, 6,
4, 2, 1,11,10,13, 7, 8,15, 9,12, 5, 6, 3, 0,14,
11, 8,12, 7, 1,14, 2,13, 6,15, 0, 9,10, 4, 5, 3,
],
[
12, 1,10,15, 9, 2, 6, 8, 0,13, 3, 4,14, 7, 5,11,
10,15, 4, 2, 7,12, 9, 5, 6, 1,13,14, 0,11, 3, 8,
9,14,15, 5, 2, 8,12, 3, 7, 0, 4,10, 1,13,11, 6,
4, 3, 2,12, 9, 5,15,10,11,14, 1, 7, 6, 0, 8,13,
],
[
4,11, 2,14,15, 0, 8,13, 3,12, 9, 7, 5,10, 6, 1,
13, 0,11, 7, 4, 9, 1,10,14, 3, 5,12, 2,15, 8, 6,
1, 4,11,13,12, 3, 7,14,10,15, 6, 8, 0, 5, 9, 2,
6,11,13, 8, 1, 4,10, 7, 9, 5, 0,15,14, 2, 3,12,
],
[
13, 2, 8, 4, 6,15,11, 1,10, 9, 3,14, 5, 0,12, 7,
1,15,13, 8,10, 3, 7, 4,12, 5, 6,11, 0,14, 9, 2,
7,11, 4, 1, 9,12,14, 2, 0, 6,10,13,15, 3, 5, 8,
2, 1,14, 7, 4,10, 8,13,15,12, 9, 0, 3, 5, 6,11,
],
];
// ── helpers ──────────────────────────────────────────────────────────────────
function permute(data, table, outLen) {
const out = new Uint8Array(outLen);
for (let outBit = 0; outBit < table.length; outBit++) {
const srcBit = table[outBit];
if (data[srcBit >> 3] & (1 << (7 - (srcBit & 7)))) {
out[outBit >> 3] |= 1 << (7 - (outBit & 7));
}
}
return out;
}
function rot28(value, shift) {
return ((value << shift) & 0x0fffffff) | (value >>> (28 - shift));
}
// ── key schedule ─────────────────────────────────────────────────────────────
function subkeys(key) {
var keyBuf = new Uint8Array(8);
for (var ki = 0; ki < Math.min(key.length, 8); ki++) keyBuf[ki] = key[ki];
var pc1Out = permute(keyBuf, PC1, 7);
// pc1Out is 7 bytes = 56 bits; split into two 28-bit halves
var left = (pc1Out[0] << 20) | (pc1Out[1] << 12) | (pc1Out[2] << 4) | (pc1Out[3] >> 4);
var right = ((pc1Out[3] & 0x0f) << 24) | (pc1Out[4] << 16) | (pc1Out[5] << 8) | pc1Out[6];
var result = [];
for (var ri = 0; ri < ROTATIONS.length; ri++) {
left = rot28(left, ROTATIONS[ri]);
right = rot28(right, ROTATIONS[ri]);
// Pack left(28 bits) + right(28 bits) back into 7 bytes
var buf = new Uint8Array(7);
buf[0] = (left >> 20) & 0xff;
buf[1] = (left >> 12) & 0xff;
buf[2] = (left >> 4) & 0xff;
buf[3] = ((left & 0x0f) << 4) | ((right >> 24) & 0x0f);
buf[4] = (right >> 16) & 0xff;
buf[5] = (right >> 8) & 0xff;
buf[6] = right & 0xff;
result.push(permute(buf, PC2, 6));
}
return result;
}
// ── Feistel round function ────────────────────────────────────────────────────
function roundFunc(right, subkey) {
const expanded = permute(right, E_EXPAND, 6);
const mixed = new Uint8Array(6);
for (let i = 0; i < 6; i++) mixed[i] = expanded[i] ^ subkey[i];
const [b0, b1, b2, b3, b4, b5] = mixed;
const chunks = [
b0 >> 2,
((b0 & 0x03) << 4) | (b1 >> 4),
((b1 & 0x0f) << 2) | (b2 >> 6),
b2 & 0x3f,
b3 >> 2,
((b3 & 0x03) << 4) | (b4 >> 4),
((b4 & 0x0f) << 2) | (b5 >> 6),
b5 & 0x3f,
];
const nibbles = chunks.map((chunk, boxIndex) => {
const sIndex = (chunk & 0x20) | ((chunk & 0x1e) >> 1) | ((chunk & 0x01) << 4);
return S_BOXES[boxIndex][sIndex] & 0x0f;
});
const packed = new Uint8Array([
(nibbles[0] << 4) | nibbles[1],
(nibbles[2] << 4) | nibbles[3],
(nibbles[4] << 4) | nibbles[5],
(nibbles[6] << 4) | nibbles[7],
]);
return permute(packed, P_PERM, 4);
}
// ── block decryption ──────────────────────────────────────────────────────────
function decryptBlock(block, key) {
if (block.length !== 8) throw new Error("block length must be 8 bytes");
const sks = subkeys(key);
const state = permute(block, IP, 8);
for (let index = 15; index >= 0; index--) {
const oldLeft = state.slice(0, 4);
const right = state.slice(4, 8);
state.set(right, 0);
const fValue = roundFunc(right, sks[index]);
for (let i = 0; i < 4; i++) state[4 + i] = oldLeft[i] ^ fValue[i];
}
// swap halves then apply FP
const swapped = new Uint8Array(8);
swapped.set(state.slice(4, 8), 0);
swapped.set(state.slice(0, 4), 4);
return permute(swapped, FP, 8);
}
// ── key derivation ────────────────────────────────────────────────────────────
function deriveKeyMaterial(uid) {
const combined = uid + FIXED_KEY_TEXT;
return combined.slice(0, 2) + combined.slice(4, 8) + combined.slice(10, 16) + combined.slice(18, 22);
}
function deriveKey(uid) {
const material = deriveKeyMaterial(uid);
const buf = new Uint8Array(8);
for (let i = 0; i < 8; i++) {
buf[i] = i < material.length ? material.charCodeAt(i) : 0;
}
return buf;
}
// ── public API ────────────────────────────────────────────────────────────────
function calcNewToken(token, uid) {
token = token.trim();
if (!/^[0-9a-fA-F]+$/.test(token)) throw new Error("token must be a hex string");
if (token.length % 16 !== 0) throw new Error("token hex length must be a multiple of 16");
const key = deriveKey(uid);
const data = hexToBytes(token);
const parts = [];
for (let i = 0; i < data.length; i += 8) {
parts.push(decryptBlock(data.slice(i, i + 8), key));
}
// Concatenate, strip trailing null bytes, decode as UTF-8
const combined = new Uint8Array(parts.reduce((a, b) => a + b.length, 0));
let offset = 0;
for (const p of parts) { combined.set(p, offset); offset += p.length; }
let end = combined.length;
while (end > 0 && combined[end - 1] === 0) end--;
var result = "";
for (var ci = 0; ci < end; ci++) result += String.fromCharCode(combined[ci]);
return result;
}
function hexToBytes(hex) {
const buf = new Uint8Array(hex.length / 2);
for (let i = 0; i < buf.length; i++) {
buf[i] = parseInt(hex.slice(i 2, i 2 + 2), 16);
}
return buf;
}
var CryptoJS = CryptoJS || (function (Math, undefined) {
var crypto;
if (typeof window !== 'undefined' && window.crypto) {
crypto = window.crypto;
}
if (typeof self !== 'undefined' && self.crypto) {
crypto = self.crypto;
}
if (typeof globalThis !== 'undefined' && globalThis.crypto) {
crypto = globalThis.crypto;
}
if (!crypto && typeof window !== 'undefined' && window.msCrypto) {
crypto = window.msCrypto;
}
if (!crypto && typeof global !== 'undefined' && global.crypto) {
crypto = global.crypto;
}
if (!crypto && typeof require === 'function') {
try {
crypto = require('crypto');
} catch (err) {
}
}
var cryptoSecureRandomInt = function () {
if (crypto) {
if (typeof crypto.getRandomValues === 'function') {
try {
return crypto.getRandomValues(new Uint32Array(1))[0];
} catch (err) {
}
}
if (typeof crypto.randomBytes === 'function') {
try {
return crypto.randomBytes(4).readInt32LE();
} catch (err) {
}
}
}
throw new Error('Native crypto module could not be used to get secure random number.');
};
var create = Object.create || (function () {
function F() {
}
return function (obj) {
var subtype;
F.prototype = obj;
subtype = new F();
F.prototype = null;
return subtype;
};
}());
var C = {};
var C_lib = C.lib = {};
var Base = C_lib.Base = (function () {
return {
extend: function (overrides) {
var subtype = create(this);
if (overrides) {
subtype.mixIn(overrides);
}
if (!subtype.hasOwnProperty('init') || this.init === subtype.init) {
subtype.init = function () {
subtype.$super.init.apply(this, arguments);
};
}
subtype.init.prototype = subtype;
subtype.$super = this;
return subtype;
}, create: function () {
var instance = this.extend();
instance.init.apply(instance, arguments);
return instance;
}, init: function () {
}, mixIn: function (properties) {
for (var propertyName in properties) {
if (properties.hasOwnProperty(propertyName)) {
this[propertyName] = properties[propertyName];
}
}
if (properties.hasOwnProperty('toString')) {
this.toString = properties.toString;
}
}, clone: function () {
return this.init.prototype.extend(this);
}
};
}());
var WordArray = C_lib.WordArray = Base.extend({
init: function (words, sigBytes) {
words = this.words = words || [];
if (sigBytes != undefined) {
this.sigBytes = sigBytes;
} else {
this.sigBytes = words.length * 4;
}
}, toString: function (encoder) {
return (encoder || Hex).stringify(this);
}, concat: function (wordArray) {
var thisWords = this.words;
var thatWords = wordArray.words;
var thisSigBytes = this.sigBytes;
var thatSigBytes = wordArray.sigBytes;
this.clamp();
if (thisSigBytes % 4) {
for (var i = 0; i < thatSigBytes; i++) {
var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8);
}
} else {
for (var j = 0; j < thatSigBytes; j += 4) {
thisWords[(thisSigBytes + j) >>> 2] = thatWords[j >>> 2];
}
}
this.sigBytes += thatSigBytes;
return this;
}, clamp: function () {
var words = this.words;
var sigBytes = this.sigBytes;
words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8);
words.length = Math.ceil(sigBytes / 4);
}, clone: function () {
var clone = Base.clone.call(this);
clone.words = this.words.slice(0);
return clone;
}, random: function (nBytes) {
var words = [];
var r = (function (m_w) {
var m_w = m_w;
var m_z = 0x3ade68b1;
var mask = 0xffffffff;
return function () {
m_z = (0x9069 * (m_z & 0xFFFF) + (m_z >> 0x10)) & mask;
m_w = (0x4650 * (m_w & 0xFFFF) + (m_w >> 0x10)) & mask;
var result = ((m_z << 0x10) + m_w) & mask;
result /= 0x100000000;
result += 0.5;
return result * (Math.random() > .5 ? 1 : -1);
}
});
var RANDOM = false, _r;
try {
cryptoSecureRandomInt();
RANDOM = true;
} catch (err) {
}
for (var i = 0, rcache; i < nBytes; i += 4) {
if (!RANDOM) {
_r = r((rcache || Math.random()) * 0x100000000);
rcache = _r() * 0x3ade67b7;
words.push((_r() * 0x100000000) | 0);
continue;
}
words.push(cryptoSecureRandomInt());
}
return new WordArray.init(words, nBytes);
}
});
var C_enc = C.enc = {};
var Hex = C_enc.Hex = {
stringify: function (wordArray) {
var words = wordArray.words;
var sigBytes = wordArray.sigBytes;
var hexChars = [];
for (var i = 0; i < sigBytes; i++) {
var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
hexChars.push((bite >>> 4).toString(16));
hexChars.push((bite & 0x0f).toString(16));
}
return hexChars.join('');
}, parse: function (hexStr) {
var hexStrLength = hexStr.length;
var words = [];
for (var i = 0; i < hexStrLength; i += 2) {
words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4);
}
return new WordArray.init(words, hexStrLength / 2);
}
};
var Latin1 = C_enc.Latin1 = {
stringify: function (wordArray) {
var words = wordArray.words;
var sigBytes = wordArray.sigBytes;
var latin1Chars = [];
for (var i = 0; i < sigBytes; i++) {
var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
latin1Chars.push(String.fromCharCode(bite));
}
return latin1Chars.join('');
}, parse: function (latin1Str) {
var latin1StrLength = latin1Str.length;
var words = [];
for (var i = 0; i < latin1StrLength; i++) {
words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8);
}
return new WordArray.init(words, latin1StrLength);
}
};
var Utf8 = C_enc.Utf8 = {
stringify: function (wordArray) {
try {
return decodeURIComponent(escape(Latin1.stringify(wordArray)));
} catch (e) {
throw new Error('Malformed UTF-8 data');
}
}, parse: function (utf8Str) {
return Latin1.parse(unescape(encodeURIComponent(utf8Str)));
}
};
var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({
reset: function () {
this._data = new WordArray.init();
this._nDataBytes = 0;
}, _append: function (data) {
if (typeof data == 'string') {
data = Utf8.parse(data);
}
this._data.concat(data);
this._nDataBytes += data.sigBytes;
}, _process: function (doFlush) {
var processedWords;
var data = this._data;
var dataWords = data.words;
var dataSigBytes = data.sigBytes;
var blockSize = this.blockSize;
var blockSizeBytes = blockSize * 4;
var nBlocksReady = dataSigBytes / blockSizeBytes;
if (doFlush) {
nBlocksReady = Math.ceil(nBlocksReady);
} else {
nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);
}
var nWordsReady = nBlocksReady * blockSize;
var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes);
if (nWordsReady) {
for (var offset = 0; offset < nWordsReady; offset += blockSize) {
this._doProcessBlock(dataWords, offset);
}
processedWords = dataWords.splice(0, nWordsReady);
data.sigBytes -= nBytesReady;
}
return new WordArray.init(processedWords, nBytesReady);
}, clone: function () {
var clone = Base.clone.call(this);
clone._data = this._data.clone();
return clone;
}, _minBufferSize: 0
});
var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({
cfg: Base.extend(),
init: function (cfg) {
this.cfg = this.cfg.extend(cfg);
this.reset();
}, reset: function () {
BufferedBlockAlgorithm.reset.call(this);
this._doReset();
}, update: function (messageUpdate) {
this._append(messageUpdate);
this._process();
return this;
}, finalize: function (messageUpdate) {
if (messageUpdate) {
this._append(messageUpdate);
}
var hash = this._doFinalize();
return hash;
}, blockSize: 512 / 32,
_createHelper: function (hasher) {
return function (message, cfg) {
return new hasher.init(cfg).finalize(message);
};
}, _createHmacHelper: function (hasher) {
return function (message, key) {
return new C_algo.HMAC.init(hasher, key).finalize(message);
};
}
});
var C_algo = C.algo = {};
return C;
}(Math));
(function (Math) {
var C = CryptoJS;
var C_lib = C.lib;
var WordArray = C_lib.WordArray;
var Hasher = C_lib.Hasher;
var C_algo = C.algo;
var T = [];
(function () {
for (var i = 0; i < 64; i++) {
T[i] = (Math.abs(Math.sin(i + 1)) 0x100000000) | 0;
}
}());
var MD5 = C_algo.MD5 = Hasher.extend({
_doReset: function () {
this._hash = new WordArray.init([0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476]);
}, _doProcessBlock: function (M, offset) {
for (var i = 0; i < 16; i++) {
var offset_i = offset + i;
var M_offset_i = M[offset_i];
M[offset_i] = ((((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) | (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00));
}
var H = this._hash.words;
var M_offset_0 = M[offset + 0];
var M_offset_1 = M[offset + 1];
var M_offset_2 = M[offset + 2];
var M_offset_3 = M[offset + 3];
var M_offset_4 = M[offset + 4];
var M_offset_5 = M[offset + 5];
var M_offset_6 = M[offset + 6];
var M_offset_7 = M[offset + 7];
var M_offset_8 = M[offset + 8];
var M_offset_9 = M[offset + 9];
var M_offset_10 = M[offset + 10];
var M_offset_11 = M[offset + 11];
var M_offset_12 = M[offset + 12];
var M_offset_13 = M[offset + 13];
var M_offset_14 = M[offset + 14];
var M_offset_15 = M[offset + 15];
var a = H[0];
var b = H[1];
var c = H[2];
var d = H[3];
a = FF(a, b, c, d, M_offset_0, 7, T[0]);
d = FF(d, a, b, c, M_offset_1, 12, T[1]);
c = FF(c, d, a, b, M_offset_2, 17, T[2]);
b = FF(b, c, d, a, M_offset_3, 22, T[3]);
a = FF(a, b, c, d, M_offset_4, 7, T[4]);
d = FF(d, a, b, c, M_offset_5, 12, T[5]);
c = FF(c, d, a, b, M_offset_6, 17, T[6]);
b = FF(b, c, d, a, M_offset_7, 22, T[7]);
a = FF(a, b, c, d, M_offset_8, 7, T[8]);
d = FF(d, a, b, c, M_offset_9, 12, T[9]);
c = FF(c, d, a, b, M_offset_10, 17, T[10]);
b = FF(b, c, d, a, M_offset_11, 22, T[11]);
a = FF(a, b, c, d, M_offset_12, 7, T[12]);
d = FF(d, a, b, c, M_offset_13, 12, T[13]);
c = FF(c, d, a, b, M_offset_14, 17, T[14]);
b = FF(b, c, d, a, M_offset_15, 22, T[15]);
a = GG(a, b, c, d, M_offset_1, 5, T[16]);
d = GG(d, a, b, c, M_offset_6, 9, T[17]);
c = GG(c, d, a, b, M_offset_11, 14, T[18]);
b = GG(b, c, d, a, M_offset_0, 20, T[19]);
a = GG(a, b, c, d, M_offset_5, 5, T[20]);
d = GG(d, a, b, c, M_offset_10, 9, T[21]);
c = GG(c, d, a, b, M_offset_15, 14, T[22]);
b = GG(b, c, d, a, M_offset_4, 20, T[23]);
a = GG(a, b, c, d, M_offset_9, 5, T[24]);
d = GG(d, a, b, c, M_offset_14, 9, T[25]);
c = GG(c, d, a, b, M_offset_3, 14, T[26]);
b = GG(b, c, d, a, M_offset_8, 20, T[27]);
a = GG(a, b, c, d, M_offset_13, 5, T[28]);
d = GG(d, a, b, c, M_offset_2, 9, T[29]);
c = GG(c, d, a, b, M_offset_7, 14, T[30]);
b = GG(b, c, d, a, M_offset_12, 20, T[31]);
a = HH(a, b, c, d, M_offset_5, 4, T[32]);
d = HH(d, a, b, c, M_offset_8, 11, T[33]);
c = HH(c, d, a, b, M_offset_11, 16, T[34]);
b = HH(b, c, d, a, M_offset_14, 23, T[35]);
a = HH(a, b, c, d, M_offset_1, 4, T[36]);
d = HH(d, a, b, c, M_offset_4, 11, T[37]);
c = HH(c, d, a, b, M_offset_7, 16, T[38]);
b = HH(b, c, d, a, M_offset_10, 23, T[39]);
a = HH(a, b, c, d, M_offset_13, 4, T[40]);
d = HH(d, a, b, c, M_offset_0, 11, T[41]);
c = HH(c, d, a, b, M_offset_3, 16, T[42]);
b = HH(b, c, d, a, M_offset_6, 23, T[43]);
a = HH(a, b, c, d, M_offset_9, 4, T[44]);
d = HH(d, a, b, c, M_offset_12, 11, T[45]);
c = HH(c, d, a, b, M_offset_15, 16, T[46]);
b = HH(b, c, d, a, M_offset_2, 23, T[47]);
a = II(a, b, c, d, M_offset_0, 6, T[48]);
d = II(d, a, b, c, M_offset_7, 10, T[49]);
c = II(c, d, a, b, M_offset_14, 15, T[50]);
b = II(b, c, d, a, M_offset_5, 21, T[51]);
a = II(a, b, c, d, M_offset_12, 6, T[52]);
d = II(d, a, b, c, M_offset_3, 10, T[53]);
c = II(c, d, a, b, M_offset_10, 15, T[54]);
b = II(b, c, d, a, M_offset_1, 21, T[55]);
a = II(a, b, c, d, M_offset_8, 6, T[56]);
d = II(d, a, b, c, M_offset_15, 10, T[57]);
c = II(c, d, a, b, M_offset_6, 15, T[58]);
b = II(b, c, d, a, M_offset_13, 21, T[59]);
a = II(a, b, c, d, M_offset_4, 6, T[60]);
d = II(d, a, b, c, M_offset_11, 10, T[61]);
c = II(c, d, a, b, M_offset_2, 15, T[62]);
b = II(b, c, d, a, M_offset_9, 21, T[63]);
H[0] = (H[0] + a) | 0;
H[1] = (H[1] + b) | 0;
H[2] = (H[2] + c) | 0;
H[3] = (H[3] + d) | 0;
}, _doFinalize: function () {
var data = this._data;
var dataWords = data.words;
var nBitsTotal = this._nDataBytes 8;
var nBitsLeft = data.sigBytes 8;
dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000);
var nBitsTotalL = nBitsTotal;
dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = ((((nBitsTotalH << 8) | (nBitsTotalH >>> 24)) & 0x00ff00ff) | (((nBitsTotalH << 24) | (nBitsTotalH >>> 8)) & 0xff00ff00));
dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = ((((nBitsTotalL << 8) | (nBitsTotalL >>> 24)) & 0x00ff00ff) | (((nBitsTotalL << 24) | (nBitsTotalL >>> 8)) & 0xff00ff00));
data.sigBytes = (dataWords.length + 1) 4;
this._process();
var hash = this._hash;
var H = hash.words;
for (var i = 0; i < 4; i++) {
var H_i = H[i];
H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) | (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00);
}
return hash;
}, clone: function () {
var clone = Hasher.clone.call(this);
clone._hash = this._hash.clone();
return clone;
}
});
function FF(a, b, c, d, x, s, t) {
var n = a + ((b & c) | (~b & d)) + x + t;
return ((n << s) | (n >>> (32 - s))) + b;
}
function GG(a, b, c, d, x, s, t) {
var n = a + ((b & d) | (c & ~d)) + x + t;
return ((n << s) | (n >>> (32 - s))) + b;
}
function HH(a, b, c, d, x, s, t) {
var n = a + (b ^ c ^ d) + x + t;
return ((n << s) | (n >>> (32 - s))) + b;
}
function II(a, b, c, d, x, s, t) {
var n = a + (c ^ (b | ~d)) + x + t;
return ((n << s) | (n >>> (32 - s))) + b;
}
C.MD5 = Hasher._createHelper(MD5);
C.HmacMD5 = Hasher._createHmacHelper(MD5);
}(Math));
function MD5_Encrypt(word) {
return CryptoJS.MD5(word).toString();
}
function get_sign(action,params,token = "") {
var t = "";
var items = params.split("&");
for (var i = 0; i < items.length; i++) {
var eqIdx = items[i].indexOf("=");
var value = eqIdx === -1 ? "" : items[i].slice(eqIdx + 1);
t += decodeURIComponent(value);
}
return MD5_Encrypt("6fe8d84e5e30a0712c0bb14889dd6283" + action + t + token)
}