|
@@ -1,13 +1,18 @@
|
1
|
1
|
import { AES, enc, mode, pad } from 'crypto-js';
|
2
|
2
|
|
|
3
|
+declare global {
|
|
4
|
+ interface Window {
|
|
5
|
+ crcTable: number[];
|
|
6
|
+ }
|
|
7
|
+}
|
|
8
|
+
|
3
|
9
|
class Utils {
|
4
|
10
|
private static code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split(
|
5
|
11
|
'',
|
6
|
12
|
);
|
7
|
13
|
|
8
|
14
|
public static crc32(str: string): number {
|
9
|
|
- let crcTable =
|
10
|
|
- (<any>window).crcTable || ((<any>window).crcTable = Utils.makeCRCTable());
|
|
15
|
+ let crcTable = window.crcTable || (window.crcTable = Utils.makeCRCTable());
|
11
|
16
|
let crc = 0 ^ -1;
|
12
|
17
|
|
13
|
18
|
for (let i = 0; i < str.length; i++) {
|