light-h5-core-lib 2.8.1 → 2.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LightCore.js +4 -1
- package/common/md5/MD5.js +0 -7
- package/common/util/SelfDecrypt.js +38 -0
- package/package.json +1 -1
- package/type/index.d.ts +13 -1
package/LightCore.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.NumberUtil = exports.BooleanUtil = exports.Crc32Util = exports.PromiseUtil = exports.BeizerUtil = exports.UniqueIDUtil = exports.StringUtil = exports.RandomNumUtil = exports.FloatDigitUtil = exports.DateUtil = exports.BitUtil = exports.MD5 = exports.BaseSingleton = exports.PoolObj = void 0;
|
|
6
|
+
exports.SelfDecrypt = exports.NumberUtil = exports.BooleanUtil = exports.Crc32Util = exports.PromiseUtil = exports.BeizerUtil = exports.UniqueIDUtil = exports.StringUtil = exports.RandomNumUtil = exports.FloatDigitUtil = exports.DateUtil = exports.BitUtil = exports.MD5 = exports.BaseSingleton = exports.PoolObj = void 0;
|
|
7
7
|
var PoolObj_1 = require("./pool/PoolObj");
|
|
8
8
|
Object.defineProperty(exports, "PoolObj", { enumerable: true, get: function () { return PoolObj_1.PoolObj; } });
|
|
9
9
|
var BaseSingleton_1 = require("./common/base/BaseSingleton");
|
|
@@ -32,6 +32,8 @@ var BooleanUtil_1 = require("./common/util/BooleanUtil");
|
|
|
32
32
|
Object.defineProperty(exports, "BooleanUtil", { enumerable: true, get: function () { return BooleanUtil_1.BooleanUtil; } });
|
|
33
33
|
var NumberUtil_1 = require("./common/util/NumberUtil");
|
|
34
34
|
Object.defineProperty(exports, "NumberUtil", { enumerable: true, get: function () { return NumberUtil_1.NumberUtil; } });
|
|
35
|
+
var SelfDecrypt_1 = require("./common/util/SelfDecrypt");
|
|
36
|
+
Object.defineProperty(exports, "SelfDecrypt", { enumerable: true, get: function () { return SelfDecrypt_1.SelfDecrypt; } });
|
|
35
37
|
module.exports = {
|
|
36
38
|
PoolObj: PoolObj_1.PoolObj,
|
|
37
39
|
BaseSingleton: BaseSingleton_1.BaseSingleton,
|
|
@@ -47,4 +49,5 @@ module.exports = {
|
|
|
47
49
|
Crc32Util: Crc32Util_1.default,
|
|
48
50
|
BooleanUtil: BooleanUtil_1.BooleanUtil,
|
|
49
51
|
NumberUtil: NumberUtil_1.NumberUtil,
|
|
52
|
+
SelfDecrypt: SelfDecrypt_1.SelfDecrypt,
|
|
50
53
|
};
|
package/common/md5/MD5.js
CHANGED
|
@@ -341,13 +341,6 @@ var MD5 = /** @class */ (function (_super) {
|
|
|
341
341
|
MD5.prototype.bit_rol = function (num, cnt) {
|
|
342
342
|
return (num << cnt) | (num >>> (32 - cnt));
|
|
343
343
|
};
|
|
344
|
-
MD5.prototype.selfDecrypt = function (data, secretKey) {
|
|
345
|
-
var info = "";
|
|
346
|
-
for (var i = 0, j = data.length; i < j; i++) {
|
|
347
|
-
info += String.fromCharCode(data.charCodeAt(i) ^ (secretKey[i % secretKey.length]).charCodeAt(0));
|
|
348
|
-
}
|
|
349
|
-
return info;
|
|
350
|
-
};
|
|
351
344
|
return MD5;
|
|
352
345
|
}(BaseSingleton_1.BaseSingleton));
|
|
353
346
|
exports.MD5 = MD5;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SelfDecrypt = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* 解码
|
|
6
|
+
* @author Aonaufly
|
|
7
|
+
*/
|
|
8
|
+
var SelfDecrypt = /** @class */ (function () {
|
|
9
|
+
function SelfDecrypt() {
|
|
10
|
+
}
|
|
11
|
+
SelfDecrypt.b64Decode = function (b64) {
|
|
12
|
+
// 浏览器安全解码,自动补 =
|
|
13
|
+
var s = b64.replace(/[^A-Za-z0-9+/]/g, '');
|
|
14
|
+
var bin = atob(s);
|
|
15
|
+
return new Uint8Array(bin.length).map(function (_, i) { return bin.charCodeAt(i); });
|
|
16
|
+
};
|
|
17
|
+
SelfDecrypt.b64Encode = function (bytes) {
|
|
18
|
+
var bin = '';
|
|
19
|
+
for (var i = 0; i < bytes.length; i++) {
|
|
20
|
+
bin += String.fromCharCode(bytes[i]);
|
|
21
|
+
}
|
|
22
|
+
return btoa(bin);
|
|
23
|
+
};
|
|
24
|
+
SelfDecrypt.xorBytes = function (bytes, key) {
|
|
25
|
+
var k = new TextEncoder().encode(key);
|
|
26
|
+
return bytes.map(function (b, i) { return b ^ k[i % k.length]; });
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* 解码
|
|
30
|
+
*/
|
|
31
|
+
SelfDecrypt.decryptBase64 = function (b64, key) {
|
|
32
|
+
var cipher = SelfDecrypt.b64Decode(b64);
|
|
33
|
+
var plain = SelfDecrypt.xorBytes(cipher, key);
|
|
34
|
+
return new TextDecoder().decode(plain);
|
|
35
|
+
};
|
|
36
|
+
return SelfDecrypt;
|
|
37
|
+
}());
|
|
38
|
+
exports.SelfDecrypt = SelfDecrypt;
|
package/package.json
CHANGED
package/type/index.d.ts
CHANGED
|
@@ -272,7 +272,6 @@ export declare class MD5 extends BaseSingleton<MD5> {
|
|
|
272
272
|
md5_ii(a: any, b: any, c: any, d: any, x: any, s: any, t: any): number;
|
|
273
273
|
safe_add(x: any, y: any): number;
|
|
274
274
|
bit_rol(num: any, cnt: any): number;
|
|
275
|
-
selfDecrypt(data: string, secretKey: string): string;
|
|
276
275
|
}
|
|
277
276
|
/**
|
|
278
277
|
* 异步处理工具
|
|
@@ -319,5 +318,18 @@ export declare class NumberUtil {
|
|
|
319
318
|
*/
|
|
320
319
|
static getProtoNum(data: any, key: string, defaultValue?: number): number;
|
|
321
320
|
}
|
|
321
|
+
/**
|
|
322
|
+
* 解码
|
|
323
|
+
* @author Aonaufly
|
|
324
|
+
*/
|
|
325
|
+
export declare class SelfDecrypt {
|
|
326
|
+
private static b64Decode;
|
|
327
|
+
private static b64Encode;
|
|
328
|
+
private static xorBytes;
|
|
329
|
+
/**
|
|
330
|
+
* 解码
|
|
331
|
+
*/
|
|
332
|
+
static decryptBase64(b64: string, key: string): string;
|
|
333
|
+
}
|
|
322
334
|
|
|
323
335
|
export {};
|