From dbb59570d87359361b1c44b3a7995dde39a74dca Mon Sep 17 00:00:00 2001 From: justagoodman <2576495532@qq.com> Date: Mon, 4 Apr 2022 16:20:09 +0800 Subject: [PATCH] full decode of encyption --- App/API/APIConstant.ts | 2 +- App/API/decoder.js | 10 +++- App/API/encoder.js | 7 ++- App/API/encrypt_key.js | 129 ----------------------------------------- 4 files changed, 14 insertions(+), 134 deletions(-) delete mode 100644 App/API/encrypt_key.js diff --git a/App/API/APIConstant.ts b/App/API/APIConstant.ts index 26c2d61..f69d3c5 100644 --- a/App/API/APIConstant.ts +++ b/App/API/APIConstant.ts @@ -28,7 +28,7 @@ export enum API_ABILITY { API_BLOG_INFO = 'https://www.asjmapihost.cc/blog', } -export const BASE_CDN_URL = 'https://cdn-msp.18comic.art'; +export const BASE_CDN_URL = 'https://cdn-msp.18comic.org'; export const BASE_CDN_YD_URL = 'https://yd.18comic.asia'; export const API_VERSION = '1.1.0'; diff --git a/App/API/decoder.js b/App/API/decoder.js index 571329a..6f63356 100644 --- a/App/API/decoder.js +++ b/App/API/decoder.js @@ -1,15 +1,19 @@ -import encrypt_key from './encrypt_key'; +import { + encodeKey +} from './encoder'; const CryptoJS = require('crypto-js'); -import { magic } from './encoder'; +import { + magic +} from './encoder'; export const salt = '18comicAPPContent'; export default function decode(encrypted) { let data; try { - let key = encrypt_key(magic + salt); + let key = encodeKey(magic + salt); console.log(key); let vector = CryptoJS.enc.Utf8.parse(key); console.log(vector); diff --git a/App/API/encoder.js b/App/API/encoder.js index f63f8ad..def9bce 100644 --- a/App/API/encoder.js +++ b/App/API/encoder.js @@ -1,5 +1,5 @@ -import encodeKey from './encrypt_key'; import {API_VERSION} from './APIConstant'; +const CryptoJS = require('crypto-js'); export const magic = '1614446604'; @@ -13,6 +13,11 @@ export function randomMagic() { return Math.floor(f.getTime() / 1e3); } +export function encodeKey(key) { + console.log(CryptoJS.MD5(key).toString()) + return CryptoJS.MD5(key).toString() +} + export default function getToken() { const TokenParam = magic + ',' + version; const token = encodeKey(magic + salt); diff --git a/App/API/encrypt_key.js b/App/API/encrypt_key.js deleted file mode 100644 index e3ed752..0000000 --- a/App/API/encrypt_key.js +++ /dev/null @@ -1,129 +0,0 @@ -/* eslint-disable */ -function module_n() { - var n = { - utf8: { - stringToBytes: function(t) { - return n['bin']['stringToBytes'](unescape(encodeURIComponent(t))) - }, - bytesToString: function(t) { - return decodeURIComponent(escape(n['bin']['bytesToString'](t))) - } - }, - bin: { - stringToBytes: function(n) { - for (var t = [], o = 0; o < n.length; o++) t.push(255 & n.charCodeAt(o)); - return t - }, - bytesToString: function(n) { - for (var t = [], o = 0; o < n.length; o++) t.push(String.fromCharCode(n[o])); - return t.join('') - } - } - }; - return n -} - -function module_t() { - var t, n; - t = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/', n = { - rotl: function(t, n) { - return t << n | t >>> 32 - n - }, - rotr: function(t, n) { - return t << 32 - n | t >>> n - }, - endian: function(t) { - if (t.constructor == Number) return 16711935 & n.rotl(t, 8) | 4278255360 & n.rotl(t, 24); - for (var o = 0; o < t.length; o++) t[o] = n.endian(t[o]); - return t - }, - randomBytes: function(t) { - for (var n = []; t > 0; t--) n.push(Math.floor(256 * Math.random())); - return n - }, - bytesToWords: function(t) { - for (var n = [], o = 0, u = 0; o < t.length; o++, u += 8) n[u >>> 5] |= t[o] << 24 - u % 32; - return n - }, - wordsToBytes: function(t) { - for (var n = [], o = 0; o < 32 * t.length; o += 8) n.push(t[o >>> 5] >>> 24 - o % 32 & 255); - return n - }, - bytesToHex: function(t) { - for (var n = [], o = 0; o < t.length; o++) n.push((t[o] >>> 4).toString(16)), n.push((15 & t[o]).toString(16)); - return n.join('') - }, - hexToBytes: function(t) { - for (var n = [], o = 0; o < t.length; o += 2) n.push(parseInt(t.substr(o, 2), 16)); - return n - }, - bytesToBase64: function(n) { - for (var o = [], u = 0; u < n.length; u += 3) - for (var f = n[u] << 16 | n[u + 1] << 8 | n[u + 2], s = 0; s < 4; s++) 8 * u + 6 * s <= 8 * n.length ? o.push(t.charAt(f >>> 6 * (3 - s) & 63)) : o.push('='); - return o.join('') - }, - base64ToBytes: function(n) { - n = n.replace(/[^A-Z0-9+\/]/gi, ''); - for (var o = [], u = 0, f = 0; u < n.length; f = ++u % 4) 0 != f && o.push((t.indexOf(n.charAt(u - 1)) & Math.pow(2, -2 * f + 8) - 1) << 2 * f | t.indexOf(n.charAt(u)) >>> 6 - 2 * f); - return o - } - } - return n -} - -function module_o() { - function n(n) { - return !!n.constructor && 'function' == typeof n.constructor.isBuffer && n.constructor.isBuffer(n) - } - - function t(t) { - return 'function' == typeof t.readFloatLE && 'function' == typeof t.slice && n(t.slicfete(0, 0)) - } - - return function(o) { - return null != o && (n(o) || t(o) || !!o._isBuffer) - } -} - - -function module_dec() { - var t, n, o, s, u; - - t = module_t, n = module_n().utf8, o = module_o, s = module_n().bin, - (u = function(c, f) { - c.constructor == String ? c = f && 'binary' === f.encoding ? s.stringToBytes(c) : n.stringToBytes(c) : o(c) ? c = Array.prototype.slice.call(c, 0) : Array.isArray(c) || c.constructor === Uint8Array || (c = c.toString()); - for (var y = t().bytesToWords(c), l = 8 * c.length, _ = 1732584193, v = -271733879, h = -1732584194, b = 271733878, T = 0; T < y.length; T++) y[T] = 16711935 & (y[T] << 8 | y[T] >>> 24) | 4278255360 & (y[T] << 24 | y[T] >>> 8); - y[l >>> 5] |= 128 << l % 32, y[14 + (l + 64 >>> 9 << 4)] = l; - var A = u._ff, - B = u._gg, - S = u._hh, - p = u._ii; - for (T = 0; T < y.length; T += 16) { - var w = _, - x = v, - z = h, - k = b; - v = p(v = p(v = p(v = p(v = S(v = S(v = S(v = S(v = B(v = B(v = B(v = B(v = A(v = A(v = A(v = A(v, h = A(h, b = A(b, _ = A(_, v, h, b, y[T + 0], 7, -680876936), v, h, y[T + 1], 12, -389564586), _, v, y[T + 2], 17, 606105819), b, _, y[T + 3], 22, -1044525330), h = A(h, b = A(b, _ = A(_, v, h, b, y[T + 4], 7, -176418897), v, h, y[T + 5], 12, 1200080426), _, v, y[T + 6], 17, -1473231341), b, _, y[T + 7], 22, -45705983), h = A(h, b = A(b, _ = A(_, v, h, b, y[T + 8], 7, 1770035416), v, h, y[T + 9], 12, -1958414417), _, v, y[T + 10], 17, -42063), b, _, y[T + 11], 22, -1990404162), h = A(h, b = A(b, _ = A(_, v, h, b, y[T + 12], 7, 1804603682), v, h, y[T + 13], 12, -40341101), _, v, y[T + 14], 17, -1502002290), b, _, y[T + 15], 22, 1236535329), h = B(h, b = B(b, _ = B(_, v, h, b, y[T + 1], 5, -165796510), v, h, y[T + 6], 9, -1069501632), _, v, y[T + 11], 14, 643717713), b, _, y[T + 0], 20, -373897302), h = B(h, b = B(b, _ = B(_, v, h, b, y[T + 5], 5, -701558691), v, h, y[T + 10], 9, 38016083), _, v, y[T + 15], 14, -660478335), b, _, y[T + 4], 20, -405537848), h = B(h, b = B(b, _ = B(_, v, h, b, y[T + 9], 5, 568446438), v, h, y[T + 14], 9, -1019803690), _, v, y[T + 3], 14, -187363961), b, _, y[T + 8], 20, 1163531501), h = B(h, b = B(b, _ = B(_, v, h, b, y[T + 13], 5, -1444681467), v, h, y[T + 2], 9, -51403784), _, v, y[T + 7], 14, 1735328473), b, _, y[T + 12], 20, -1926607734), h = S(h, b = S(b, _ = S(_, v, h, b, y[T + 5], 4, -378558), v, h, y[T + 8], 11, -2022574463), _, v, y[T + 11], 16, 1839030562), b, _, y[T + 14], 23, -35309556), h = S(h, b = S(b, _ = S(_, v, h, b, y[T + 1], 4, -1530992060), v, h, y[T + 4], 11, 1272893353), _, v, y[T + 7], 16, -155497632), b, _, y[T + 10], 23, -1094730640), h = S(h, b = S(b, _ = S(_, v, h, b, y[T + 13], 4, 681279174), v, h, y[T + 0], 11, -358537222), _, v, y[T + 3], 16, -722521979), b, _, y[T + 6], 23, 76029189), h = S(h, b = S(b, _ = S(_, v, h, b, y[T + 9], 4, -640364487), v, h, y[T + 12], 11, -421815835), _, v, y[T + 15], 16, 530742520), b, _, y[T + 2], 23, -995338651), h = p(h, b = p(b, _ = p(_, v, h, b, y[T + 0], 6, -198630844), v, h, y[T + 7], 10, 1126891415), _, v, y[T + 14], 15, -1416354905), b, _, y[T + 5], 21, -57434055), h = p(h, b = p(b, _ = p(_, v, h, b, y[T + 12], 6, 1700485571), v, h, y[T + 3], 10, -1894986606), _, v, y[T + 10], 15, -1051523), b, _, y[T + 1], 21, -2054922799), h = p(h, b = p(b, _ = p(_, v, h, b, y[T + 8], 6, 1873313359), v, h, y[T + 15], 10, -30611744), _, v, y[T + 6], 15, -1560198380), b, _, y[T + 13], 21, 1309151649), h = p(h, b = p(b, _ = p(_, v, h, b, y[T + 4], 6, -145523070), v, h, y[T + 11], 10, -1120210379), _, v, y[T + 2], 15, 718787259), b, _, y[T + 9], 21, -343485551), _ = _ + w >>> 0, v = v + x >>> 0, h = h + z >>> 0, b = b + k >>> 0 - } - return t().endian([_, v, h, b]) - })._ff = function(t, n, o, s, u, c, f) { - var y = t + (n & o | ~n & s) + (u >>> 0) + f; - return (y << c | y >>> 32 - c) + n - }, u._gg = function(t, n, o, s, u, c, f) { - var y = t + (n & s | o & ~s) + (u >>> 0) + f; - return (y << c | y >>> 32 - c) + n - }, u._hh = function(t, n, o, s, u, c, f) { - var y = t + (n ^ o ^ s) + (u >>> 0) + f; - return (y << c | y >>> 32 - c) + n - }, u._ii = function(t, n, o, s, u, c, f) { - var y = t + (o ^ (n | ~s)) + (u >>> 0) + f; - return (y << c | y >>> 32 - c) + n - }, u._blocksize = 16, u._digestsize = 16 - return function(n, o) { - if (void 0 === n || null === n) throw new Error('Illegal argument ' + n); - var c = t().wordsToBytes(u(n, o)); - return o && o.asBytes ? c : o && o.asString ? s.bytesToString(c) : t().bytesToHex(c) - } -} - -export default module_dec() \ No newline at end of file