light-h5-core-lib 2.7.4 → 2.7.5
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 +1 -4
- package/common/util/CryptUtil.js +4 -2
- package/common/util/RandomNumUtil.js +15 -1
- package/package.json +2 -4
- package/type/index.d.ts +5 -15
package/LightCore.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.BeizerUtil = exports.UniqueIDUtil = exports.StringUtil = exports.RandomNumUtil = exports.FloatDigitUtil = exports.DateUtil = exports.BitUtil = exports.MD5 = exports.BaseSingleton = exports.PoolObj = void 0;
|
|
4
4
|
var PoolObj_1 = require("./pool/PoolObj");
|
|
5
5
|
Object.defineProperty(exports, "PoolObj", { enumerable: true, get: function () { return PoolObj_1.PoolObj; } });
|
|
6
6
|
var BaseSingleton_1 = require("./common/base/BaseSingleton");
|
|
@@ -19,8 +19,6 @@ var UniqueIDUtil_1 = require("./common/util/UniqueIDUtil");
|
|
|
19
19
|
Object.defineProperty(exports, "UniqueIDUtil", { enumerable: true, get: function () { return UniqueIDUtil_1.UniqueIDUtil; } });
|
|
20
20
|
var BeizerUtil_1 = require("./common/util/BeizerUtil");
|
|
21
21
|
Object.defineProperty(exports, "BeizerUtil", { enumerable: true, get: function () { return BeizerUtil_1.BeizerUtil; } });
|
|
22
|
-
var CryptUtil_1 = require("./common/util/CryptUtil");
|
|
23
|
-
Object.defineProperty(exports, "CryptUtil", { enumerable: true, get: function () { return CryptUtil_1.CryptUtil; } });
|
|
24
22
|
var MD5_1 = require("./common/md5/MD5");
|
|
25
23
|
Object.defineProperty(exports, "MD5", { enumerable: true, get: function () { return MD5_1.MD5; } });
|
|
26
24
|
module.exports = {
|
|
@@ -34,5 +32,4 @@ module.exports = {
|
|
|
34
32
|
StringUtil: StringUtil_1.StringUtil,
|
|
35
33
|
UniqueIDUtil: UniqueIDUtil_1.UniqueIDUtil,
|
|
36
34
|
BeizerUtil: BeizerUtil_1.BeizerUtil,
|
|
37
|
-
CryptUtil: CryptUtil_1.CryptUtil,
|
|
38
35
|
};
|
package/common/util/CryptUtil.js
CHANGED
|
@@ -15,7 +15,8 @@ var CryptUtil = /** @class */ (function () {
|
|
|
15
15
|
//#region AES-256 ECB
|
|
16
16
|
/** 加密函数AES-256 ECB */
|
|
17
17
|
CryptUtil.encryptAes = function (plainText, key) {
|
|
18
|
-
var
|
|
18
|
+
var keyBytes = crypto_es_1.default.enc.Utf8.parse(key);
|
|
19
|
+
var encrypted = crypto_es_1.default.AES.encrypt(crypto_es_1.default.enc.Utf8.parse(plainText), keyBytes, {
|
|
19
20
|
mode: crypto_es_1.default.mode.ECB,
|
|
20
21
|
padding: crypto_es_1.default.pad.Pkcs7,
|
|
21
22
|
});
|
|
@@ -23,7 +24,8 @@ var CryptUtil = /** @class */ (function () {
|
|
|
23
24
|
};
|
|
24
25
|
/**解密函数AES-256 ECB*/
|
|
25
26
|
CryptUtil.decryptAes = function (cipherText, key) {
|
|
26
|
-
var
|
|
27
|
+
var keyBytes = crypto_es_1.default.enc.Utf8.parse(key);
|
|
28
|
+
var decrypted = crypto_es_1.default.AES.decrypt(cipherText, keyBytes, {
|
|
27
29
|
mode: crypto_es_1.default.mode.ECB,
|
|
28
30
|
padding: crypto_es_1.default.pad.Pkcs7,
|
|
29
31
|
});
|
|
@@ -9,7 +9,7 @@ var RandomNumUtil = /** @class */ (function () {
|
|
|
9
9
|
function RandomNumUtil() {
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* 获取一定范围的随机整数
|
|
13
13
|
*
|
|
14
14
|
* <b>( min ≤ r ≤ max )</b>
|
|
15
15
|
*
|
|
@@ -35,6 +35,20 @@ var RandomNumUtil = /** @class */ (function () {
|
|
|
35
35
|
return isInt ? min : Math.round(min);
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
+
/**
|
|
39
|
+
* 打乱数组
|
|
40
|
+
*/
|
|
41
|
+
RandomNumUtil.shuffleSort = function (arr) {
|
|
42
|
+
var n = arr.length;
|
|
43
|
+
var index;
|
|
44
|
+
var temp;
|
|
45
|
+
while (n--) {
|
|
46
|
+
index = Math.floor(Math.random() * n);
|
|
47
|
+
temp = arr[index];
|
|
48
|
+
arr[index] = arr[n];
|
|
49
|
+
arr[n] = temp;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
38
52
|
return RandomNumUtil;
|
|
39
53
|
}());
|
|
40
54
|
exports.RandomNumUtil = RandomNumUtil;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "light-h5-core-lib",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.5",
|
|
4
4
|
"description": "light core lib",
|
|
5
5
|
"main": "./LightCore.js",
|
|
6
6
|
"types": "./type/index.d.ts",
|
|
@@ -14,7 +14,5 @@
|
|
|
14
14
|
],
|
|
15
15
|
"author": "Aonaufly",
|
|
16
16
|
"license": "ISC",
|
|
17
|
-
"dependencies": {
|
|
18
|
-
"crypto-es": "^2.1.0"
|
|
19
|
-
}
|
|
17
|
+
"dependencies": {}
|
|
20
18
|
}
|
package/type/index.d.ts
CHANGED
|
@@ -125,7 +125,7 @@ export declare class FloatDigitUtil {
|
|
|
125
125
|
*/
|
|
126
126
|
export declare class RandomNumUtil {
|
|
127
127
|
/**
|
|
128
|
-
*
|
|
128
|
+
* 获取一定范围的随机整数
|
|
129
129
|
*
|
|
130
130
|
* <b>( min ≤ r ≤ max )</b>
|
|
131
131
|
*
|
|
@@ -134,6 +134,10 @@ export declare class RandomNumUtil {
|
|
|
134
134
|
* @param isInt 是否返回整数
|
|
135
135
|
*/
|
|
136
136
|
static randomNumBoth(min: number, max: number, isInt?: boolean): number;
|
|
137
|
+
/**
|
|
138
|
+
* 打乱数组
|
|
139
|
+
*/
|
|
140
|
+
static shuffleSort<T>(arr: T[]): void;
|
|
137
141
|
}
|
|
138
142
|
/**
|
|
139
143
|
* 字符串工具
|
|
@@ -194,20 +198,6 @@ export declare class BeizerUtil {
|
|
|
194
198
|
}[], precision?: number): number;
|
|
195
199
|
private static getBezierPoint;
|
|
196
200
|
}
|
|
197
|
-
/**
|
|
198
|
-
* 加解密工具
|
|
199
|
-
* @author Aonaufly
|
|
200
|
-
*/
|
|
201
|
-
export declare class CryptUtil {
|
|
202
|
-
/** 加密函数AES-256 ECB */
|
|
203
|
-
static encryptAes(plainText: string, key: string): string;
|
|
204
|
-
/**解密函数AES-256 ECB*/
|
|
205
|
-
static decryptAes(cipherText: string, key: string): string;
|
|
206
|
-
/**
|
|
207
|
-
* MD5
|
|
208
|
-
*/
|
|
209
|
-
static md5(text: string): string;
|
|
210
|
-
}
|
|
211
201
|
export declare class MD5 extends BaseSingleton<MD5> {
|
|
212
202
|
private hexcase;
|
|
213
203
|
private b64pad;
|