Add files via upload
This commit is contained in:
parent
0448431ac6
commit
6f60d5c8f0
278
JS/crypto-js.js
278
JS/crypto-js.js
@ -1,13 +1,12 @@
|
|||||||
;(function (root, factory) {
|
;
|
||||||
|
(function(root, factory) {
|
||||||
if (typeof exports === "object") {
|
if (typeof exports === "object") {
|
||||||
// CommonJS
|
// CommonJS
|
||||||
module.exports = exports = factory();
|
module.exports = exports = factory();
|
||||||
}
|
} else if (typeof define === "function" && define.amd) {
|
||||||
else if (typeof define === "function" && define.amd) {
|
|
||||||
// AMD
|
// AMD
|
||||||
define([], factory);
|
define([], factory);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// Global (browser)
|
// Global (browser)
|
||||||
globalThis.CryptoJS = factory();
|
globalThis.CryptoJS = factory();
|
||||||
}
|
}
|
||||||
@ -71,7 +70,8 @@
|
|||||||
// Use randomBytes method (NodeJS)
|
// Use randomBytes method (NodeJS)
|
||||||
if (typeof crypto.randomBytes === 'function') {
|
if (typeof crypto.randomBytes === 'function') {
|
||||||
try {
|
try {
|
||||||
return crypto.randomBytes(4).readInt32LE();
|
return crypto.randomBytes(4)
|
||||||
|
.readInt32LE();
|
||||||
} catch (err) {}
|
} catch (err) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -81,7 +81,6 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Local polyfill of Object.create
|
* Local polyfill of Object.create
|
||||||
|
|
||||||
*/
|
*/
|
||||||
var create = Object.create || (function() {
|
var create = Object.create || (function() {
|
||||||
function F() {}
|
function F() {}
|
||||||
@ -190,8 +189,7 @@
|
|||||||
* }
|
* }
|
||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
init: function () {
|
init: function() {},
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copies properties into this object.
|
* Copies properties into this object.
|
||||||
@ -275,7 +273,8 @@
|
|||||||
* var string = wordArray.toString(CryptoJS.enc.Utf8);
|
* var string = wordArray.toString(CryptoJS.enc.Utf8);
|
||||||
*/
|
*/
|
||||||
toString: function(encoder) {
|
toString: function(encoder) {
|
||||||
return (encoder || Hex).stringify(this);
|
return (encoder || Hex)
|
||||||
|
.stringify(this);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -406,8 +405,10 @@
|
|||||||
var hexChars = [];
|
var hexChars = [];
|
||||||
for (var i = 0; i < sigBytes; i++) {
|
for (var i = 0; i < sigBytes; i++) {
|
||||||
var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
|
var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
|
||||||
hexChars.push((bite >>> 4).toString(16));
|
hexChars.push((bite >>> 4)
|
||||||
hexChars.push((bite & 0x0f).toString(16));
|
.toString(16));
|
||||||
|
hexChars.push((bite & 0x0f)
|
||||||
|
.toString(16));
|
||||||
}
|
}
|
||||||
|
|
||||||
return hexChars.join('');
|
return hexChars.join('');
|
||||||
@ -769,7 +770,8 @@
|
|||||||
*/
|
*/
|
||||||
_createHelper: function(hasher) {
|
_createHelper: function(hasher) {
|
||||||
return function(message, cfg) {
|
return function(message, cfg) {
|
||||||
return new hasher.init(cfg).finalize(message);
|
return new hasher.init(cfg)
|
||||||
|
.finalize(message);
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -788,7 +790,8 @@
|
|||||||
*/
|
*/
|
||||||
_createHmacHelper: function(hasher) {
|
_createHmacHelper: function(hasher) {
|
||||||
return function(message, key) {
|
return function(message, key) {
|
||||||
return new C_algo.HMAC.init(hasher, key).finalize(message);
|
return new C_algo.HMAC.init(hasher, key)
|
||||||
|
.finalize(message);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -1111,15 +1114,7 @@
|
|||||||
|
|
||||||
// Convert other array views to uint8
|
// Convert other array views to uint8
|
||||||
if (
|
if (
|
||||||
typedArray instanceof Int8Array ||
|
typedArray instanceof Int8Array || (typeof Uint8ClampedArray !== "undefined" && typedArray instanceof Uint8ClampedArray) || typedArray instanceof Int16Array || typedArray instanceof Uint16Array || typedArray instanceof Int32Array || typedArray instanceof Uint32Array || typedArray instanceof Float32Array || typedArray instanceof Float64Array) {
|
||||||
(typeof Uint8ClampedArray !== "undefined" && typedArray instanceof Uint8ClampedArray) ||
|
|
||||||
typedArray instanceof Int16Array ||
|
|
||||||
typedArray instanceof Uint16Array ||
|
|
||||||
typedArray instanceof Int32Array ||
|
|
||||||
typedArray instanceof Uint32Array ||
|
|
||||||
typedArray instanceof Float32Array ||
|
|
||||||
typedArray instanceof Float64Array
|
|
||||||
) {
|
|
||||||
typedArray = new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength);
|
typedArray = new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1319,7 +1314,8 @@
|
|||||||
|
|
||||||
var triplet = (byte1 << 16) | (byte2 << 8) | byte3;
|
var triplet = (byte1 << 16) | (byte2 << 8) | byte3;
|
||||||
|
|
||||||
for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) {
|
for (var j = 0;
|
||||||
|
(j < 4) && (i + j * 0.75 < sigBytes); j++) {
|
||||||
base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f));
|
base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1439,7 +1435,8 @@
|
|||||||
|
|
||||||
var triplet = (byte1 << 16) | (byte2 << 8) | byte3;
|
var triplet = (byte1 << 16) | (byte2 << 8) | byte3;
|
||||||
|
|
||||||
for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) {
|
for (var j = 0;
|
||||||
|
(j < 4) && (i + j * 0.75 < sigBytes); j++) {
|
||||||
base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f));
|
base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1542,8 +1539,7 @@
|
|||||||
_doReset: function() {
|
_doReset: function() {
|
||||||
this._hash = new WordArray.init([
|
this._hash = new WordArray.init([
|
||||||
0x67452301, 0xefcdab89,
|
0x67452301, 0xefcdab89,
|
||||||
0x98badcfe, 0x10325476
|
0x98badcfe, 0x10325476]);
|
||||||
]);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_doProcessBlock: function(M, offset) {
|
_doProcessBlock: function(M, offset) {
|
||||||
@ -1554,9 +1550,7 @@
|
|||||||
var M_offset_i = M[offset_i];
|
var M_offset_i = M[offset_i];
|
||||||
|
|
||||||
M[offset_i] = (
|
M[offset_i] = (
|
||||||
(((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) |
|
(((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) | (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00));
|
||||||
(((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shortcuts
|
// Shortcuts
|
||||||
@ -1675,13 +1669,9 @@
|
|||||||
var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000);
|
var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000);
|
||||||
var nBitsTotalL = nBitsTotal;
|
var nBitsTotalL = nBitsTotal;
|
||||||
dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = (
|
dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = (
|
||||||
(((nBitsTotalH << 8) | (nBitsTotalH >>> 24)) & 0x00ff00ff) |
|
(((nBitsTotalH << 8) | (nBitsTotalH >>> 24)) & 0x00ff00ff) | (((nBitsTotalH << 24) | (nBitsTotalH >>> 8)) & 0xff00ff00));
|
||||||
(((nBitsTotalH << 24) | (nBitsTotalH >>> 8)) & 0xff00ff00)
|
|
||||||
);
|
|
||||||
dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (
|
dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (
|
||||||
(((nBitsTotalL << 8) | (nBitsTotalL >>> 24)) & 0x00ff00ff) |
|
(((nBitsTotalL << 8) | (nBitsTotalL >>> 24)) & 0x00ff00ff) | (((nBitsTotalL << 24) | (nBitsTotalL >>> 8)) & 0xff00ff00));
|
||||||
(((nBitsTotalL << 24) | (nBitsTotalL >>> 8)) & 0xff00ff00)
|
|
||||||
);
|
|
||||||
|
|
||||||
data.sigBytes = (dataWords.length + 1) * 4;
|
data.sigBytes = (dataWords.length + 1) * 4;
|
||||||
|
|
||||||
@ -1697,8 +1687,7 @@
|
|||||||
// Shortcut
|
// Shortcut
|
||||||
var H_i = H[i];
|
var H_i = H[i];
|
||||||
|
|
||||||
H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) |
|
H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) | (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00);
|
||||||
(((H_i << 24) | (H_i >>> 8)) & 0xff00ff00);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return final computed hash
|
// Return final computed hash
|
||||||
@ -1786,8 +1775,7 @@
|
|||||||
this._hash = new WordArray.init([
|
this._hash = new WordArray.init([
|
||||||
0x67452301, 0xefcdab89,
|
0x67452301, 0xefcdab89,
|
||||||
0x98badcfe, 0x10325476,
|
0x98badcfe, 0x10325476,
|
||||||
0xc3d2e1f0
|
0xc3d2e1f0]);
|
||||||
]);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_doProcessBlock: function(M, offset) {
|
_doProcessBlock: function(M, offset) {
|
||||||
@ -1975,14 +1963,10 @@
|
|||||||
W[i] = M[offset + i] | 0;
|
W[i] = M[offset + i] | 0;
|
||||||
} else {
|
} else {
|
||||||
var gamma0x = W[i - 15];
|
var gamma0x = W[i - 15];
|
||||||
var gamma0 = ((gamma0x << 25) | (gamma0x >>> 7)) ^
|
var gamma0 = ((gamma0x << 25) | (gamma0x >>> 7)) ^ ((gamma0x << 14) | (gamma0x >>> 18)) ^ (gamma0x >>> 3);
|
||||||
((gamma0x << 14) | (gamma0x >>> 18)) ^
|
|
||||||
(gamma0x >>> 3);
|
|
||||||
|
|
||||||
var gamma1x = W[i - 2];
|
var gamma1x = W[i - 2];
|
||||||
var gamma1 = ((gamma1x << 15) | (gamma1x >>> 17)) ^
|
var gamma1 = ((gamma1x << 15) | (gamma1x >>> 17)) ^ ((gamma1x << 13) | (gamma1x >>> 19)) ^ (gamma1x >>> 10);
|
||||||
((gamma1x << 13) | (gamma1x >>> 19)) ^
|
|
||||||
(gamma1x >>> 10);
|
|
||||||
|
|
||||||
W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16];
|
W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16];
|
||||||
}
|
}
|
||||||
@ -2095,8 +2079,7 @@
|
|||||||
_doReset: function() {
|
_doReset: function() {
|
||||||
this._hash = new WordArray.init([
|
this._hash = new WordArray.init([
|
||||||
0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939,
|
0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939,
|
||||||
0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4
|
0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4]);
|
||||||
]);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_doFinalize: function() {
|
_doFinalize: function() {
|
||||||
@ -2197,8 +2180,7 @@
|
|||||||
X64Word_create(0x28db77f5, 0x23047d84), X64Word_create(0x32caab7b, 0x40c72493),
|
X64Word_create(0x28db77f5, 0x23047d84), X64Word_create(0x32caab7b, 0x40c72493),
|
||||||
X64Word_create(0x3c9ebe0a, 0x15c9bebc), X64Word_create(0x431d67c4, 0x9c100d4c),
|
X64Word_create(0x3c9ebe0a, 0x15c9bebc), X64Word_create(0x431d67c4, 0x9c100d4c),
|
||||||
X64Word_create(0x4cc5d4be, 0xcb3e42b6), X64Word_create(0x597f299c, 0xfc657e2a),
|
X64Word_create(0x4cc5d4be, 0xcb3e42b6), X64Word_create(0x597f299c, 0xfc657e2a),
|
||||||
X64Word_create(0x5fcb6fab, 0x3ad6faec), X64Word_create(0x6c44198c, 0x4a475817)
|
X64Word_create(0x5fcb6fab, 0x3ad6faec), X64Word_create(0x6c44198c, 0x4a475817)];
|
||||||
];
|
|
||||||
|
|
||||||
// Reusable objects
|
// Reusable objects
|
||||||
var W = [];
|
var W = [];
|
||||||
@ -2217,8 +2199,7 @@
|
|||||||
new X64Word.init(0x6a09e667, 0xf3bcc908), new X64Word.init(0xbb67ae85, 0x84caa73b),
|
new X64Word.init(0x6a09e667, 0xf3bcc908), new X64Word.init(0xbb67ae85, 0x84caa73b),
|
||||||
new X64Word.init(0x3c6ef372, 0xfe94f82b), new X64Word.init(0xa54ff53a, 0x5f1d36f1),
|
new X64Word.init(0x3c6ef372, 0xfe94f82b), new X64Word.init(0xa54ff53a, 0x5f1d36f1),
|
||||||
new X64Word.init(0x510e527f, 0xade682d1), new X64Word.init(0x9b05688c, 0x2b3e6c1f),
|
new X64Word.init(0x510e527f, 0xade682d1), new X64Word.init(0x9b05688c, 0x2b3e6c1f),
|
||||||
new X64Word.init(0x1f83d9ab, 0xfb41bd6b), new X64Word.init(0x5be0cd19, 0x137e2179)
|
new X64Word.init(0x1f83d9ab, 0xfb41bd6b), new X64Word.init(0x5be0cd19, 0x137e2179)]);
|
||||||
]);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_doProcessBlock: function(M, offset) {
|
_doProcessBlock: function(M, offset) {
|
||||||
@ -2468,8 +2449,7 @@
|
|||||||
new X64Word.init(0xcbbb9d5d, 0xc1059ed8), new X64Word.init(0x629a292a, 0x367cd507),
|
new X64Word.init(0xcbbb9d5d, 0xc1059ed8), new X64Word.init(0x629a292a, 0x367cd507),
|
||||||
new X64Word.init(0x9159015a, 0x3070dd17), new X64Word.init(0x152fecd8, 0xf70e5939),
|
new X64Word.init(0x9159015a, 0x3070dd17), new X64Word.init(0x152fecd8, 0xf70e5939),
|
||||||
new X64Word.init(0x67332667, 0xffc00b31), new X64Word.init(0x8eb44a87, 0x68581511),
|
new X64Word.init(0x67332667, 0xffc00b31), new X64Word.init(0x8eb44a87, 0x68581511),
|
||||||
new X64Word.init(0xdb0c2e0d, 0x64f98fa7), new X64Word.init(0x47b5481d, 0xbefa4fa4)
|
new X64Word.init(0xdb0c2e0d, 0x64f98fa7), new X64Word.init(0x47b5481d, 0xbefa4fa4)]);
|
||||||
]);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_doFinalize: function() {
|
_doFinalize: function() {
|
||||||
@ -2533,7 +2513,8 @@
|
|||||||
// Compute Constants
|
// Compute Constants
|
||||||
(function() {
|
(function() {
|
||||||
// Compute rho offset constants
|
// Compute rho offset constants
|
||||||
var x = 1, y = 0;
|
var x = 1,
|
||||||
|
y = 0;
|
||||||
for (var t = 0; t < 24; t++) {
|
for (var t = 0; t < 24; t++) {
|
||||||
RHO_OFFSETS[x + 5 * y] = ((t + 1) * (t + 2) / 2) % 64;
|
RHO_OFFSETS[x + 5 * y] = ((t + 1) * (t + 2) / 2) % 64;
|
||||||
|
|
||||||
@ -2625,13 +2606,9 @@
|
|||||||
|
|
||||||
// Swap endian
|
// Swap endian
|
||||||
M2i = (
|
M2i = (
|
||||||
(((M2i << 8) | (M2i >>> 24)) & 0x00ff00ff) |
|
(((M2i << 8) | (M2i >>> 24)) & 0x00ff00ff) | (((M2i << 24) | (M2i >>> 8)) & 0xff00ff00));
|
||||||
(((M2i << 24) | (M2i >>> 8)) & 0xff00ff00)
|
|
||||||
);
|
|
||||||
M2i1 = (
|
M2i1 = (
|
||||||
(((M2i1 << 8) | (M2i1 >>> 24)) & 0x00ff00ff) |
|
(((M2i1 << 8) | (M2i1 >>> 24)) & 0x00ff00ff) | (((M2i1 << 24) | (M2i1 >>> 8)) & 0xff00ff00));
|
||||||
(((M2i1 << 24) | (M2i1 >>> 8)) & 0xff00ff00)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Absorb message into state
|
// Absorb message into state
|
||||||
var lane = state[i];
|
var lane = state[i];
|
||||||
@ -2644,7 +2621,8 @@
|
|||||||
// Theta
|
// Theta
|
||||||
for (var x = 0; x < 5; x++) {
|
for (var x = 0; x < 5; x++) {
|
||||||
// Mix column lanes
|
// Mix column lanes
|
||||||
var tMsw = 0, tLsw = 0;
|
var tMsw = 0,
|
||||||
|
tLsw = 0;
|
||||||
for (var y = 0; y < 5; y++) {
|
for (var y = 0; y < 5; y++) {
|
||||||
var lane = state[x + 5 * y];
|
var lane = state[x + 5 * y];
|
||||||
tMsw ^= lane.high;
|
tMsw ^= lane.high;
|
||||||
@ -2760,13 +2738,9 @@
|
|||||||
|
|
||||||
// Swap endian
|
// Swap endian
|
||||||
laneMsw = (
|
laneMsw = (
|
||||||
(((laneMsw << 8) | (laneMsw >>> 24)) & 0x00ff00ff) |
|
(((laneMsw << 8) | (laneMsw >>> 24)) & 0x00ff00ff) | (((laneMsw << 24) | (laneMsw >>> 8)) & 0xff00ff00));
|
||||||
(((laneMsw << 24) | (laneMsw >>> 8)) & 0xff00ff00)
|
|
||||||
);
|
|
||||||
laneLsw = (
|
laneLsw = (
|
||||||
(((laneLsw << 8) | (laneLsw >>> 24)) & 0x00ff00ff) |
|
(((laneLsw << 8) | (laneLsw >>> 24)) & 0x00ff00ff) | (((laneLsw << 24) | (laneLsw >>> 8)) & 0xff00ff00));
|
||||||
(((laneLsw << 24) | (laneLsw >>> 8)) & 0xff00ff00)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Squeeze state to retrieve hash
|
// Squeeze state to retrieve hash
|
||||||
hashWords.push(laneLsw);
|
hashWords.push(laneLsw);
|
||||||
@ -2889,9 +2863,7 @@
|
|||||||
|
|
||||||
// Swap
|
// Swap
|
||||||
M[offset_i] = (
|
M[offset_i] = (
|
||||||
(((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) |
|
(((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) | (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00));
|
||||||
(((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
// Shortcut
|
// Shortcut
|
||||||
var H = this._hash.words;
|
var H = this._hash.words;
|
||||||
@ -2976,9 +2948,7 @@
|
|||||||
// Add padding
|
// Add padding
|
||||||
dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
|
dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
|
||||||
dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (
|
dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (
|
||||||
(((nBitsTotal << 8) | (nBitsTotal >>> 24)) & 0x00ff00ff) |
|
(((nBitsTotal << 8) | (nBitsTotal >>> 24)) & 0x00ff00ff) | (((nBitsTotal << 24) | (nBitsTotal >>> 8)) & 0xff00ff00));
|
||||||
(((nBitsTotal << 24) | (nBitsTotal >>> 8)) & 0xff00ff00)
|
|
||||||
);
|
|
||||||
data.sigBytes = (dataWords.length + 1) * 4;
|
data.sigBytes = (dataWords.length + 1) * 4;
|
||||||
|
|
||||||
// Hash final blocks
|
// Hash final blocks
|
||||||
@ -2994,8 +2964,7 @@
|
|||||||
var H_i = H[i];
|
var H_i = H[i];
|
||||||
|
|
||||||
// Swap
|
// Swap
|
||||||
H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) |
|
H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) | (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00);
|
||||||
(((H_i << 24) | (H_i >>> 8)) & 0xff00ff00);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return final computed hash
|
// Return final computed hash
|
||||||
@ -3191,7 +3160,8 @@
|
|||||||
// Compute HMAC
|
// Compute HMAC
|
||||||
var innerHash = hasher.finalize(messageUpdate);
|
var innerHash = hasher.finalize(messageUpdate);
|
||||||
hasher.reset();
|
hasher.reset();
|
||||||
var hmac = hasher.finalize(this._oKey.clone().concat(innerHash));
|
var hmac = hasher.finalize(this._oKey.clone()
|
||||||
|
.concat(innerHash));
|
||||||
|
|
||||||
return hmac;
|
return hmac;
|
||||||
}
|
}
|
||||||
@ -3272,7 +3242,8 @@
|
|||||||
|
|
||||||
// Generate key
|
// Generate key
|
||||||
while (derivedKeyWords.length < keySize) {
|
while (derivedKeyWords.length < keySize) {
|
||||||
var block = hmac.update(salt).finalize(blockIndex);
|
var block = hmac.update(salt)
|
||||||
|
.finalize(blockIndex);
|
||||||
hmac.reset();
|
hmac.reset();
|
||||||
|
|
||||||
// Shortcuts
|
// Shortcuts
|
||||||
@ -3321,7 +3292,8 @@
|
|||||||
* var key = CryptoJS.PBKDF2(password, salt, { keySize: 8, iterations: 1000 });
|
* var key = CryptoJS.PBKDF2(password, salt, { keySize: 8, iterations: 1000 });
|
||||||
*/
|
*/
|
||||||
C.PBKDF2 = function(password, salt, cfg) {
|
C.PBKDF2 = function(password, salt, cfg) {
|
||||||
return PBKDF2.create(cfg).compute(password, salt);
|
return PBKDF2.create(cfg)
|
||||||
|
.compute(password, salt);
|
||||||
};
|
};
|
||||||
}());
|
}());
|
||||||
|
|
||||||
@ -3402,7 +3374,8 @@
|
|||||||
if (block) {
|
if (block) {
|
||||||
hasher.update(block);
|
hasher.update(block);
|
||||||
}
|
}
|
||||||
block = hasher.update(password).finalize(salt);
|
block = hasher.update(password)
|
||||||
|
.finalize(salt);
|
||||||
hasher.reset();
|
hasher.reset();
|
||||||
|
|
||||||
// Iterations
|
// Iterations
|
||||||
@ -3437,7 +3410,8 @@
|
|||||||
* var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 });
|
* var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 });
|
||||||
*/
|
*/
|
||||||
C.EvpKDF = function(password, salt, cfg) {
|
C.EvpKDF = function(password, salt, cfg) {
|
||||||
return EvpKDF.create(cfg).compute(password, salt);
|
return EvpKDF.create(cfg)
|
||||||
|
.compute(password, salt);
|
||||||
};
|
};
|
||||||
}());
|
}());
|
||||||
|
|
||||||
@ -3627,11 +3601,13 @@
|
|||||||
return function(cipher) {
|
return function(cipher) {
|
||||||
return {
|
return {
|
||||||
encrypt: function(message, key, cfg) {
|
encrypt: function(message, key, cfg) {
|
||||||
return selectCipherStrategy(key).encrypt(cipher, message, key, cfg);
|
return selectCipherStrategy(key)
|
||||||
|
.encrypt(cipher, message, key, cfg);
|
||||||
},
|
},
|
||||||
|
|
||||||
decrypt: function(ciphertext, key, cfg) {
|
decrypt: function(ciphertext, key, cfg) {
|
||||||
return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg);
|
return selectCipherStrategy(key)
|
||||||
|
.decrypt(cipher, ciphertext, key, cfg);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -3995,7 +3971,8 @@
|
|||||||
* var string = cipherParams.toString(CryptoJS.format.OpenSSL);
|
* var string = cipherParams.toString(CryptoJS.format.OpenSSL);
|
||||||
*/
|
*/
|
||||||
toString: function(formatter) {
|
toString: function(formatter) {
|
||||||
return (formatter || this.formatter).stringify(this);
|
return (formatter || this.formatter)
|
||||||
|
.stringify(this);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -4030,7 +4007,9 @@
|
|||||||
|
|
||||||
// Format
|
// Format
|
||||||
if (salt) {
|
if (salt) {
|
||||||
wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext);
|
wordArray = WordArray.create([0x53616c74, 0x65645f5f])
|
||||||
|
.concat(salt)
|
||||||
|
.concat(ciphertext);
|
||||||
} else {
|
} else {
|
||||||
wordArray = ciphertext;
|
wordArray = ciphertext;
|
||||||
}
|
}
|
||||||
@ -4070,7 +4049,10 @@
|
|||||||
ciphertext.sigBytes -= 16;
|
ciphertext.sigBytes -= 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
return CipherParams.create({ ciphertext: ciphertext, salt: salt });
|
return CipherParams.create({
|
||||||
|
ciphertext: ciphertext,
|
||||||
|
salt: salt
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -4154,7 +4136,8 @@
|
|||||||
ciphertext = this._parse(ciphertext, cfg.format);
|
ciphertext = this._parse(ciphertext, cfg.format);
|
||||||
|
|
||||||
// Decrypt
|
// Decrypt
|
||||||
var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext);
|
var plaintext = cipher.createDecryptor(key, cfg)
|
||||||
|
.finalize(ciphertext.ciphertext);
|
||||||
|
|
||||||
return plaintext;
|
return plaintext;
|
||||||
},
|
},
|
||||||
@ -4216,14 +4199,21 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Derive key and IV
|
// Derive key and IV
|
||||||
var key = EvpKDF.create({ keySize: keySize + ivSize }).compute(password, salt);
|
var key = EvpKDF.create({
|
||||||
|
keySize: keySize + ivSize
|
||||||
|
})
|
||||||
|
.compute(password, salt);
|
||||||
|
|
||||||
// Separate key and IV
|
// Separate key and IV
|
||||||
var iv = WordArray.create(key.words.slice(keySize), ivSize * 4);
|
var iv = WordArray.create(key.words.slice(keySize), ivSize * 4);
|
||||||
key.sigBytes = keySize * 4;
|
key.sigBytes = keySize * 4;
|
||||||
|
|
||||||
// Return params
|
// Return params
|
||||||
return CipherParams.create({ key: key, iv: iv, salt: salt });
|
return CipherParams.create({
|
||||||
|
key: key,
|
||||||
|
iv: iv,
|
||||||
|
salt: salt
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -4426,8 +4416,7 @@
|
|||||||
CryptoJS.mode.CTRGladman = (function() {
|
CryptoJS.mode.CTRGladman = (function() {
|
||||||
var CTRGladman = CryptoJS.lib.BlockCipherMode.extend();
|
var CTRGladman = CryptoJS.lib.BlockCipherMode.extend();
|
||||||
|
|
||||||
function incWord(word)
|
function incWord(word) {
|
||||||
{
|
|
||||||
if (((word >> 24) & 0xff) === 0xff) { //overflow
|
if (((word >> 24) & 0xff) === 0xff) { //overflow
|
||||||
var b1 = (word >> 16) & 0xff;
|
var b1 = (word >> 16) & 0xff;
|
||||||
var b2 = (word >> 8) & 0xff;
|
var b2 = (word >> 8) & 0xff;
|
||||||
@ -4436,25 +4425,17 @@
|
|||||||
if (b1 === 0xff) // overflow b1
|
if (b1 === 0xff) // overflow b1
|
||||||
{
|
{
|
||||||
b1 = 0;
|
b1 = 0;
|
||||||
if (b2 === 0xff)
|
if (b2 === 0xff) {
|
||||||
{
|
|
||||||
b2 = 0;
|
b2 = 0;
|
||||||
if (b3 === 0xff)
|
if (b3 === 0xff) {
|
||||||
{
|
|
||||||
b3 = 0;
|
b3 = 0;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
++b3;
|
++b3;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
++b2;
|
++b2;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
++b1;
|
++b1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4462,18 +4443,14 @@
|
|||||||
word += (b1 << 16);
|
word += (b1 << 16);
|
||||||
word += (b2 << 8);
|
word += (b2 << 8);
|
||||||
word += b3;
|
word += b3;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
word += (0x01 << 24);
|
word += (0x01 << 24);
|
||||||
}
|
}
|
||||||
return word;
|
return word;
|
||||||
}
|
}
|
||||||
|
|
||||||
function incCounter(counter)
|
function incCounter(counter) {
|
||||||
{
|
if ((counter[0] = incWord(counter[0])) === 0) {
|
||||||
if ((counter[0] = incWord(counter[0])) === 0)
|
|
||||||
{
|
|
||||||
// encr_data in fileenc.c from Dr Brian Gladman's counts only with DWORD j < 8
|
// encr_data in fileenc.c from Dr Brian Gladman's counts only with DWORD j < 8
|
||||||
counter[1] = incWord(counter[1]);
|
counter[1] = incWord(counter[1]);
|
||||||
}
|
}
|
||||||
@ -4617,7 +4594,8 @@
|
|||||||
var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes;
|
var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes;
|
||||||
|
|
||||||
// Pad
|
// Pad
|
||||||
data.concat(CryptoJS.lib.WordArray.random(nPaddingBytes - 1)).
|
data.concat(CryptoJS.lib.WordArray.random(nPaddingBytes - 1))
|
||||||
|
.
|
||||||
concat(CryptoJS.lib.WordArray.create([nPaddingBytes << 24], 1));
|
concat(CryptoJS.lib.WordArray.create([nPaddingBytes << 24], 1));
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -4686,11 +4664,9 @@
|
|||||||
* A noop padding strategy.
|
* A noop padding strategy.
|
||||||
*/
|
*/
|
||||||
CryptoJS.pad.NoPadding = {
|
CryptoJS.pad.NoPadding = {
|
||||||
pad: function () {
|
pad: function() {},
|
||||||
},
|
|
||||||
|
|
||||||
unpad: function () {
|
unpad: function() {}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -4736,7 +4712,9 @@
|
|||||||
*/
|
*/
|
||||||
parse: function(input) {
|
parse: function(input) {
|
||||||
var ciphertext = Hex.parse(input);
|
var ciphertext = Hex.parse(input);
|
||||||
return CipherParams.create({ ciphertext: ciphertext });
|
return CipherParams.create({
|
||||||
|
ciphertext: ciphertext
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}());
|
}());
|
||||||
@ -4878,8 +4856,7 @@
|
|||||||
if (invKsRow < 4 || ksRow <= 4) {
|
if (invKsRow < 4 || ksRow <= 4) {
|
||||||
invKeySchedule[invKsRow] = t;
|
invKeySchedule[invKsRow] = t;
|
||||||
} else {
|
} else {
|
||||||
invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[(t >>> 16) & 0xff]] ^
|
invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[(t >>> 16) & 0xff]] ^ INV_SUB_MIX_2[SBOX[(t >>> 8) & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]];
|
||||||
INV_SUB_MIX_2[SBOX[(t >>> 8) & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -4974,8 +4951,7 @@
|
|||||||
60, 52, 44, 36, 63, 55, 47, 39,
|
60, 52, 44, 36, 63, 55, 47, 39,
|
||||||
31, 23, 15, 7, 62, 54, 46, 38,
|
31, 23, 15, 7, 62, 54, 46, 38,
|
||||||
30, 22, 14, 6, 61, 53, 45, 37,
|
30, 22, 14, 6, 61, 53, 45, 37,
|
||||||
29, 21, 13, 5, 28, 20, 12, 4
|
29, 21, 13, 5, 28, 20, 12, 4];
|
||||||
];
|
|
||||||
|
|
||||||
// Permuted Choice 2 constants
|
// Permuted Choice 2 constants
|
||||||
var PC2 = [
|
var PC2 = [
|
||||||
@ -4986,15 +4962,13 @@
|
|||||||
41, 52, 31, 37, 47, 55,
|
41, 52, 31, 37, 47, 55,
|
||||||
30, 40, 51, 45, 33, 48,
|
30, 40, 51, 45, 33, 48,
|
||||||
44, 49, 39, 56, 34, 53,
|
44, 49, 39, 56, 34, 53,
|
||||||
46, 42, 50, 36, 29, 32
|
46, 42, 50, 36, 29, 32];
|
||||||
];
|
|
||||||
|
|
||||||
// Cumulative bit shift constants
|
// Cumulative bit shift constants
|
||||||
var BIT_SHIFTS = [1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28];
|
var BIT_SHIFTS = [1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28];
|
||||||
|
|
||||||
// SBOXes and round permutation constants
|
// SBOXes and round permutation constants
|
||||||
var SBOX_P = [
|
var SBOX_P = [{
|
||||||
{
|
|
||||||
0x0: 0x808200,
|
0x0: 0x808200,
|
||||||
0x10000000: 0x8000,
|
0x10000000: 0x8000,
|
||||||
0x20000000: 0x808002,
|
0x20000000: 0x808002,
|
||||||
@ -5059,8 +5033,7 @@
|
|||||||
0xd8000001: 0x0,
|
0xd8000001: 0x0,
|
||||||
0xe8000001: 0x8200,
|
0xe8000001: 0x8200,
|
||||||
0xf8000001: 0x808002
|
0xf8000001: 0x808002
|
||||||
},
|
}, {
|
||||||
{
|
|
||||||
0x0: 0x40084010,
|
0x0: 0x40084010,
|
||||||
0x1000000: 0x4000,
|
0x1000000: 0x4000,
|
||||||
0x2000000: 0x80000,
|
0x2000000: 0x80000,
|
||||||
@ -5125,8 +5098,7 @@
|
|||||||
0x1d800000: 0x4010,
|
0x1d800000: 0x4010,
|
||||||
0x1e800000: 0x40080010,
|
0x1e800000: 0x40080010,
|
||||||
0x1f800000: 0x84000
|
0x1f800000: 0x84000
|
||||||
},
|
}, {
|
||||||
{
|
|
||||||
0x0: 0x104,
|
0x0: 0x104,
|
||||||
0x100000: 0x0,
|
0x100000: 0x0,
|
||||||
0x200000: 0x4000100,
|
0x200000: 0x4000100,
|
||||||
@ -5191,8 +5163,7 @@
|
|||||||
0x1d80000: 0x4010000,
|
0x1d80000: 0x4010000,
|
||||||
0x1e80000: 0x4,
|
0x1e80000: 0x4,
|
||||||
0x1f80000: 0x10100
|
0x1f80000: 0x10100
|
||||||
},
|
}, {
|
||||||
{
|
|
||||||
0x0: 0x80401000,
|
0x0: 0x80401000,
|
||||||
0x10000: 0x80001040,
|
0x10000: 0x80001040,
|
||||||
0x20000: 0x401040,
|
0x20000: 0x401040,
|
||||||
@ -5257,8 +5228,7 @@
|
|||||||
0x1d8000: 0x80401000,
|
0x1d8000: 0x80401000,
|
||||||
0x1e8000: 0x400000,
|
0x1e8000: 0x400000,
|
||||||
0x1f8000: 0x401040
|
0x1f8000: 0x401040
|
||||||
},
|
}, {
|
||||||
{
|
|
||||||
0x0: 0x80,
|
0x0: 0x80,
|
||||||
0x1000: 0x1040000,
|
0x1000: 0x1040000,
|
||||||
0x2000: 0x40000,
|
0x2000: 0x40000,
|
||||||
@ -5323,8 +5293,7 @@
|
|||||||
0x1d800: 0x40000,
|
0x1d800: 0x40000,
|
||||||
0x1e800: 0x20040000,
|
0x1e800: 0x20040000,
|
||||||
0x1f800: 0x20000080
|
0x1f800: 0x20000080
|
||||||
},
|
}, {
|
||||||
{
|
|
||||||
0x0: 0x10000008,
|
0x0: 0x10000008,
|
||||||
0x100: 0x2000,
|
0x100: 0x2000,
|
||||||
0x200: 0x10200000,
|
0x200: 0x10200000,
|
||||||
@ -5389,8 +5358,7 @@
|
|||||||
0x1d80: 0x0,
|
0x1d80: 0x0,
|
||||||
0x1e80: 0x10000000,
|
0x1e80: 0x10000000,
|
||||||
0x1f80: 0x10002008
|
0x1f80: 0x10002008
|
||||||
},
|
}, {
|
||||||
{
|
|
||||||
0x0: 0x100000,
|
0x0: 0x100000,
|
||||||
0x10: 0x2000401,
|
0x10: 0x2000401,
|
||||||
0x20: 0x400,
|
0x20: 0x400,
|
||||||
@ -5455,8 +5423,7 @@
|
|||||||
0x1d8: 0x400,
|
0x1d8: 0x400,
|
||||||
0x1e8: 0x2000400,
|
0x1e8: 0x2000400,
|
||||||
0x1f8: 0x100001
|
0x1f8: 0x100001
|
||||||
},
|
}, {
|
||||||
{
|
|
||||||
0x0: 0x8000820,
|
0x0: 0x8000820,
|
||||||
0x1: 0x20000,
|
0x1: 0x20000,
|
||||||
0x2: 0x8000000,
|
0x2: 0x8000000,
|
||||||
@ -5521,14 +5488,12 @@
|
|||||||
0x8000001d: 0x820,
|
0x8000001d: 0x820,
|
||||||
0x8000001e: 0x20020,
|
0x8000001e: 0x20020,
|
||||||
0x8000001f: 0x8020800
|
0x8000001f: 0x8020800
|
||||||
}
|
}];
|
||||||
];
|
|
||||||
|
|
||||||
// Masks that select the SBOX input
|
// Masks that select the SBOX input
|
||||||
var SBOX_MASK = [
|
var SBOX_MASK = [
|
||||||
0xf8000001, 0x1f800000, 0x01f80000, 0x001f8000,
|
0xf8000001, 0x1f800000, 0x01f80000, 0x001f8000,
|
||||||
0x0001f800, 0x00001f80, 0x000001f8, 0x8000001f
|
0x0001f800, 0x00001f80, 0x000001f8, 0x8000001f];
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DES block cipher algorithm.
|
* DES block cipher algorithm.
|
||||||
@ -5863,8 +5828,7 @@
|
|||||||
|
|
||||||
// Swap endian
|
// Swap endian
|
||||||
for (var i = 0; i < 4; i++) {
|
for (var i = 0; i < 4; i++) {
|
||||||
K[i] = (((K[i] << 8) | (K[i] >>> 24)) & 0x00ff00ff) |
|
K[i] = (((K[i] << 8) | (K[i] >>> 24)) & 0x00ff00ff) | (((K[i] << 24) | (K[i] >>> 8)) & 0xff00ff00);
|
||||||
(((K[i] << 24) | (K[i] >>> 8)) & 0xff00ff00);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate initial state values
|
// Generate initial state values
|
||||||
@ -5872,16 +5836,11 @@
|
|||||||
K[0], (K[3] << 16) | (K[2] >>> 16),
|
K[0], (K[3] << 16) | (K[2] >>> 16),
|
||||||
K[1], (K[0] << 16) | (K[3] >>> 16),
|
K[1], (K[0] << 16) | (K[3] >>> 16),
|
||||||
K[2], (K[1] << 16) | (K[0] >>> 16),
|
K[2], (K[1] << 16) | (K[0] >>> 16),
|
||||||
K[3], (K[2] << 16) | (K[1] >>> 16)
|
K[3], (K[2] << 16) | (K[1] >>> 16)];
|
||||||
];
|
|
||||||
|
|
||||||
// Generate initial counter values
|
// Generate initial counter values
|
||||||
var C = this._C = [
|
var C = this._C = [
|
||||||
(K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff),
|
(K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff), (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff), (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff), (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff)];
|
||||||
(K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff),
|
|
||||||
(K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff),
|
|
||||||
(K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff)
|
|
||||||
];
|
|
||||||
|
|
||||||
// Carry bit
|
// Carry bit
|
||||||
this._b = 0;
|
this._b = 0;
|
||||||
@ -5941,8 +5900,7 @@
|
|||||||
|
|
||||||
for (var i = 0; i < 4; i++) {
|
for (var i = 0; i < 4; i++) {
|
||||||
// Swap endian
|
// Swap endian
|
||||||
S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) |
|
S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) | (((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00);
|
||||||
(((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00);
|
|
||||||
|
|
||||||
// Encrypt
|
// Encrypt
|
||||||
M[offset + i] ^= S[i];
|
M[offset + i] ^= S[i];
|
||||||
@ -6044,16 +6002,11 @@
|
|||||||
K[0], (K[3] << 16) | (K[2] >>> 16),
|
K[0], (K[3] << 16) | (K[2] >>> 16),
|
||||||
K[1], (K[0] << 16) | (K[3] >>> 16),
|
K[1], (K[0] << 16) | (K[3] >>> 16),
|
||||||
K[2], (K[1] << 16) | (K[0] >>> 16),
|
K[2], (K[1] << 16) | (K[0] >>> 16),
|
||||||
K[3], (K[2] << 16) | (K[1] >>> 16)
|
K[3], (K[2] << 16) | (K[1] >>> 16)];
|
||||||
];
|
|
||||||
|
|
||||||
// Generate initial counter values
|
// Generate initial counter values
|
||||||
var C = this._C = [
|
var C = this._C = [
|
||||||
(K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff),
|
(K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff), (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff), (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff), (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff)];
|
||||||
(K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff),
|
|
||||||
(K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff),
|
|
||||||
(K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff)
|
|
||||||
];
|
|
||||||
|
|
||||||
// Carry bit
|
// Carry bit
|
||||||
this._b = 0;
|
this._b = 0;
|
||||||
@ -6113,8 +6066,7 @@
|
|||||||
|
|
||||||
for (var i = 0; i < 4; i++) {
|
for (var i = 0; i < 4; i++) {
|
||||||
// Swap endian
|
// Swap endian
|
||||||
S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) |
|
S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) | (((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00);
|
||||||
(((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00);
|
|
||||||
|
|
||||||
// Encrypt
|
// Encrypt
|
||||||
M[offset + i] ^= S[i];
|
M[offset + i] ^= S[i];
|
||||||
|
52
JS/drpy2.min.js
vendored
52
JS/drpy2.min.js
vendored
@ -194,7 +194,7 @@ function pre() {
|
|||||||
}
|
}
|
||||||
let rule = {};
|
let rule = {};
|
||||||
let vercode = typeof pdfl === "function" ? "drpy2.1" : "drpy2";
|
let vercode = typeof pdfl === "function" ? "drpy2.1" : "drpy2";
|
||||||
const VERSION = vercode + " 3.9.50beta24 20240601";
|
const VERSION = vercode + " 3.9.50beta27 20240608";
|
||||||
const MOBILE_UA = "Mozilla/5.0 (Linux; Android 11; Pixel 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.91 Mobile Safari/537.36";
|
const MOBILE_UA = "Mozilla/5.0 (Linux; Android 11; Pixel 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.91 Mobile Safari/537.36";
|
||||||
const PC_UA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36";
|
const PC_UA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36";
|
||||||
const UA = "Mozilla/5.0";
|
const UA = "Mozilla/5.0";
|
||||||
@ -202,7 +202,7 @@ const UC_UA = "Mozilla/5.0 (Linux; U; Android 9; zh-CN; MI 9 Build/PKQ1.181121.0
|
|||||||
const IOS_UA = "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1";
|
const IOS_UA = "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1";
|
||||||
const RULE_CK = "cookie";
|
const RULE_CK = "cookie";
|
||||||
const CATE_EXCLUDE = "首页|留言|APP|下载|资讯|新闻|动态";
|
const CATE_EXCLUDE = "首页|留言|APP|下载|资讯|新闻|动态";
|
||||||
const TAB_EXCLUDE = "猜你|喜欢|下载|剧情|热播";
|
const TAB_EXCLUDE = "猜你|喜欢|下载|剧情|榜|评论";
|
||||||
const OCR_RETRY = 3;
|
const OCR_RETRY = 3;
|
||||||
const OCR_API = "https://api.nn.ci/ocr/b64/text";
|
const OCR_API = "https://api.nn.ci/ocr/b64/text";
|
||||||
if (typeof MY_URL === "undefined") {
|
if (typeof MY_URL === "undefined") {
|
||||||
@ -1675,7 +1675,19 @@ function homeVodParse(homeVodObj) {
|
|||||||
let t2 = (new Date)
|
let t2 = (new Date)
|
||||||
.getTime();
|
.getTime();
|
||||||
console.log("加载首页推荐耗时:" + (t2 - t1) + "毫秒");
|
console.log("加载首页推荐耗时:" + (t2 - t1) + "毫秒");
|
||||||
if (rule.图片替换 && rule.图片替换.includes("=>")) {
|
if (rule.图片替换) {
|
||||||
|
if (rule.图片替换.startsWith("js:")) {
|
||||||
|
d.forEach(it => {
|
||||||
|
try {
|
||||||
|
var input = it.vod_pic;
|
||||||
|
eval(rule.图片替换.trim()
|
||||||
|
.replace("js:", ""));
|
||||||
|
it.vod_pic = input
|
||||||
|
} catch (e) {
|
||||||
|
log(`图片:${it.vod_pic}替换错误:${e.message}`)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else if (rule.图片替换.includes("=>")) {
|
||||||
let replace_from = rule.图片替换.split("=>")[0];
|
let replace_from = rule.图片替换.split("=>")[0];
|
||||||
let replace_to = rule.图片替换.split("=>")[1];
|
let replace_to = rule.图片替换.split("=>")[1];
|
||||||
d.forEach(it => {
|
d.forEach(it => {
|
||||||
@ -1684,6 +1696,7 @@ function homeVodParse(homeVodObj) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (rule.图片来源) {
|
if (rule.图片来源) {
|
||||||
d.forEach(it => {
|
d.forEach(it => {
|
||||||
if (it.vod_pic && it.vod_pic.startsWith("http")) {
|
if (it.vod_pic && it.vod_pic.startsWith("http")) {
|
||||||
@ -1813,7 +1826,19 @@ function categoryParse(cateObj) {
|
|||||||
console.log(e.message)
|
console.log(e.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rule.图片替换 && rule.图片替换.includes("=>")) {
|
if (rule.图片替换) {
|
||||||
|
if (rule.图片替换.startsWith("js:")) {
|
||||||
|
d.forEach(it => {
|
||||||
|
try {
|
||||||
|
var input = it.vod_pic;
|
||||||
|
eval(rule.图片替换.trim()
|
||||||
|
.replace("js:", ""));
|
||||||
|
it.vod_pic = input
|
||||||
|
} catch (e) {
|
||||||
|
log(`图片:${it.vod_pic}替换错误:${e.message}`)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else if (rule.图片替换.includes("=>")) {
|
||||||
let replace_from = rule.图片替换.split("=>")[0];
|
let replace_from = rule.图片替换.split("=>")[0];
|
||||||
let replace_to = rule.图片替换.split("=>")[1];
|
let replace_to = rule.图片替换.split("=>")[1];
|
||||||
d.forEach(it => {
|
d.forEach(it => {
|
||||||
@ -1822,6 +1847,7 @@ function categoryParse(cateObj) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (rule.图片来源) {
|
if (rule.图片来源) {
|
||||||
d.forEach(it => {
|
d.forEach(it => {
|
||||||
if (it.vod_pic && it.vod_pic.startsWith("http")) {
|
if (it.vod_pic && it.vod_pic.startsWith("http")) {
|
||||||
@ -2007,7 +2033,19 @@ function searchParse(searchObj) {
|
|||||||
return "{}"
|
return "{}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rule.图片替换 && rule.图片替换.includes("=>")) {
|
if (rule.图片替换) {
|
||||||
|
if (rule.图片替换.startsWith("js:")) {
|
||||||
|
d.forEach(it => {
|
||||||
|
try {
|
||||||
|
var input = it.vod_pic;
|
||||||
|
eval(rule.图片替换.trim()
|
||||||
|
.replace("js:", ""));
|
||||||
|
it.vod_pic = input
|
||||||
|
} catch (e) {
|
||||||
|
log(`图片:${it.vod_pic}替换错误:${e.message}`)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else if (rule.图片替换.includes("=>")) {
|
||||||
let replace_from = rule.图片替换.split("=>")[0];
|
let replace_from = rule.图片替换.split("=>")[0];
|
||||||
let replace_to = rule.图片替换.split("=>")[1];
|
let replace_to = rule.图片替换.split("=>")[1];
|
||||||
d.forEach(it => {
|
d.forEach(it => {
|
||||||
@ -2016,6 +2054,7 @@ function searchParse(searchObj) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (rule.图片来源) {
|
if (rule.图片来源) {
|
||||||
d.forEach(it => {
|
d.forEach(it => {
|
||||||
if (it.vod_pic && it.vod_pic.startsWith("http")) {
|
if (it.vod_pic && it.vod_pic.startsWith("http")) {
|
||||||
@ -2426,7 +2465,7 @@ function proxyParse(proxyObj) {
|
|||||||
log("准备执行本地代理规则:\n" + proxyObj.proxy_rule);
|
log("准备执行本地代理规则:\n" + proxyObj.proxy_rule);
|
||||||
try {
|
try {
|
||||||
eval(proxyObj.proxy_rule);
|
eval(proxyObj.proxy_rule);
|
||||||
if (input && input !== proxyObj.params && Array.isArray(input) && input.length === 3) {
|
if (input && input !== proxyObj.params && Array.isArray(input) && input.length >= 3) {
|
||||||
return input
|
return input
|
||||||
} else {
|
} else {
|
||||||
return [404, "text/plain", "Not Found"]
|
return [404, "text/plain", "Not Found"]
|
||||||
@ -2596,6 +2635,7 @@ function init(ext) {
|
|||||||
console.log(`执行${rule.hostJs}获取host发生错误:` + e.message)
|
console.log(`执行${rule.hostJs}获取host发生错误:` + e.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
rule.类型 = rule.类型 || "影视";
|
||||||
rule.url = rule.url || "";
|
rule.url = rule.url || "";
|
||||||
rule.double = rule.double || false;
|
rule.double = rule.double || false;
|
||||||
rule.homeUrl = rule.homeUrl || "";
|
rule.homeUrl = rule.homeUrl || "";
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
var rule = {
|
var rule = {
|
||||||
title: '腾云驾雾[官]',
|
title: '腾云驾雾[官]',
|
||||||
host: 'https://v.%71%71.com',
|
host: 'https://v.%71%71.com',
|
||||||
homeUrl: '/x/bu/pagesheet/list?_all=1&append=1&channel=choice&listpage=1&offset=0&pagesize=21&iarea=-1&sort=18',
|
// homeUrl: '/x/bu/pagesheet/list?_all=1&append=1&channel=choice&listpage=1&offset=0&pagesize=21&iarea=-1&sort=18',
|
||||||
|
homeUrl: '/x/bu/pagesheet/list?_all=1&append=1&channel=cartoon&listpage=1&offset=0&pagesize=21&iarea=-1&sort=18',
|
||||||
detailUrl: 'https://node.video.%71%71.com/x/api/float_vinfo2?cid=fyid',
|
detailUrl: 'https://node.video.%71%71.com/x/api/float_vinfo2?cid=fyid',
|
||||||
searchUrl: '/x/search/?q=**&stag=fypage',
|
searchUrl: '/x/search/?q=**&stag=fypage',
|
||||||
searchable: 2,
|
searchable: 2,
|
||||||
@ -9,7 +10,8 @@ var rule = {
|
|||||||
multi: 1,
|
multi: 1,
|
||||||
// url:'/channel/fyclass?listpage=fypage&channel=fyclass&sort=18&_all=1',
|
// url:'/channel/fyclass?listpage=fypage&channel=fyclass&sort=18&_all=1',
|
||||||
url: '/x/bu/pagesheet/list?_all=1&append=1&channel=fyclass&listpage=1&offset=((fypage-1)*21)&pagesize=21&iarea=-1',
|
url: '/x/bu/pagesheet/list?_all=1&append=1&channel=fyclass&listpage=1&offset=((fypage-1)*21)&pagesize=21&iarea=-1',
|
||||||
filter_url: 'sort={{fl.sort or 18}}&year={{fl.year}}&pay={{fl.pay}}',
|
// filter_url: 'sort={{fl.sort or 18}}&year={{fl.year}}&pay={{fl.pay}}',
|
||||||
|
filter_url: 'sort={{fl.sort or 75}}&year={{fl.year}}&pay={{fl.pay}}',
|
||||||
filter: 'H4sIAAAAAAAAA+2UzUrDQBCA32XOEZLUJrGvIj0saaDBNisxBkIJCG3Fi4oepIg3EQoieqiH+vM23Zq+hRuaZLZ4ce9z2/lmd2d2+NgR+H0e+gF0DkdwFGTQgRMeJ2BAxIaSwvrqVnxcyzhlg9PttqjED2c/45cSy8DyIDcavr57q/lBw8XTd/E6qbnT8M3zTFyc72RtC/Jumd+2c8wy7KZ4nxSL5Z9uxHS+Gc+r83sWVp1eVttl4Dluk1h93YubWZVwduplAYuxoFguVp+P/y5om/Z+/YxyqfAW8pbKbeS2yi3kO/ebyE2Fy1nXXBm7DDzknspd5K7KHeSOytvI2+XAugYkKWlD2mhrM+RpSB8OmaNvTsriMEgycofc0XbHZ3HCeUTukDv67vTDQY/MIXO0zelxn5M4JI6mOPkvgswSEpgPAAA=',
|
filter: 'H4sIAAAAAAAAA+2UzUrDQBCA32XOEZLUJrGvIj0saaDBNisxBkIJCG3Fi4oepIg3EQoieqiH+vM23Zq+hRuaZLZ4ce9z2/lmd2d2+NgR+H0e+gF0DkdwFGTQgRMeJ2BAxIaSwvrqVnxcyzhlg9PttqjED2c/45cSy8DyIDcavr57q/lBw8XTd/E6qbnT8M3zTFyc72RtC/Jumd+2c8wy7KZ4nxSL5Z9uxHS+Gc+r83sWVp1eVttl4Dluk1h93YubWZVwduplAYuxoFguVp+P/y5om/Z+/YxyqfAW8pbKbeS2yi3kO/ebyE2Fy1nXXBm7DDzknspd5K7KHeSOytvI2+XAugYkKWlD2mhrM+RpSB8OmaNvTsriMEgycofc0XbHZ3HCeUTukDv67vTDQY/MIXO0zelxn5M4JI6mOPkvgswSEpgPAAA=',
|
||||||
headers: {
|
headers: {
|
||||||
'User-Agent': 'PC_UA'
|
'User-Agent': 'PC_UA'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user