@loaders.gl/crypto 3.1.3 → 4.0.0-alpha.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/dist/bundle.js +2 -2
- package/dist/bundle.js.map +1 -0
- package/dist/index.js +25 -45
- package/dist/index.js.map +1 -0
- package/dist/lib/algorithms/crc32.js +26 -25
- package/dist/{es5/lib → lib}/algorithms/crc32.js.map +1 -1
- package/dist/lib/algorithms/crc32c.js +29 -33
- package/dist/lib/algorithms/crc32c.js.map +1 -0
- package/dist/lib/algorithms/md5-wasm.js +449 -414
- package/dist/lib/algorithms/md5-wasm.js.map +1 -0
- package/dist/lib/crc32-hash.js +54 -45
- package/dist/lib/crc32-hash.js.map +1 -0
- package/dist/lib/crc32c-hash.js +53 -49
- package/dist/lib/crc32c-hash.js.map +1 -0
- package/dist/lib/crypto-hash.js +70 -55
- package/dist/lib/crypto-hash.js.map +1 -0
- package/dist/lib/hash.js +36 -27
- package/dist/lib/hash.js.map +1 -0
- package/dist/lib/md5-hash.js +22 -31
- package/dist/lib/md5-hash.js.map +1 -0
- package/dist/lib/node-hash.js +49 -39
- package/dist/lib/node-hash.js.map +1 -0
- package/dist/lib/sha256-hash.js +11 -13
- package/dist/lib/sha256-hash.js.map +1 -0
- package/dist/lib/utils/base64-utils.js +57 -62
- package/dist/lib/utils/base64-utils.js.map +1 -0
- package/dist/lib/utils/digest-utils.js +13 -25
- package/dist/lib/utils/digest-utils.js.map +1 -0
- package/dist/types.js +2 -2
- package/dist/{es5/types.js.map → types.js.map} +0 -0
- package/dist/{es5/workers → workers}/cryptojs-worker.ts.disabled +0 -0
- package/dist/workers/worker.js +24 -22
- package/dist/workers/worker.js.map +1 -0
- package/package.json +7 -7
- package/dist/es5/bundle.js +0 -7
- package/dist/es5/bundle.js.map +0 -1
- package/dist/es5/index.js +0 -91
- package/dist/es5/index.js.map +0 -1
- package/dist/es5/lib/algorithms/crc32.js +0 -51
- package/dist/es5/lib/algorithms/crc32c.js +0 -54
- package/dist/es5/lib/algorithms/crc32c.js.map +0 -1
- package/dist/es5/lib/algorithms/md5-wasm.js +0 -487
- package/dist/es5/lib/algorithms/md5-wasm.js.map +0 -1
- package/dist/es5/lib/crc32-hash.js +0 -213
- package/dist/es5/lib/crc32-hash.js.map +0 -1
- package/dist/es5/lib/crc32c-hash.js +0 -212
- package/dist/es5/lib/crc32c-hash.js.map +0 -1
- package/dist/es5/lib/crypto-hash.js +0 -261
- package/dist/es5/lib/crypto-hash.js.map +0 -1
- package/dist/es5/lib/hash.js +0 -203
- package/dist/es5/lib/hash.js.map +0 -1
- package/dist/es5/lib/md5-hash.js +0 -93
- package/dist/es5/lib/md5-hash.js.map +0 -1
- package/dist/es5/lib/node-hash.js +0 -209
- package/dist/es5/lib/node-hash.js.map +0 -1
- package/dist/es5/lib/sha256-hash.js +0 -48
- package/dist/es5/lib/sha256-hash.js.map +0 -1
- package/dist/es5/lib/utils/base64-utils.js +0 -69
- package/dist/es5/lib/utils/base64-utils.js.map +0 -1
- package/dist/es5/lib/utils/digest-utils.js +0 -27
- package/dist/es5/lib/utils/digest-utils.js.map +0 -1
- package/dist/es5/types.js +0 -2
- package/dist/es5/workers/worker.js +0 -84
- package/dist/es5/workers/worker.js.map +0 -1
- package/dist/esm/bundle.js +0 -5
- package/dist/esm/bundle.js.map +0 -1
- package/dist/esm/index.js +0 -27
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/lib/algorithms/crc32.js +0 -31
- package/dist/esm/lib/algorithms/crc32.js.map +0 -1
- package/dist/esm/lib/algorithms/crc32c.js +0 -34
- package/dist/esm/lib/algorithms/crc32c.js.map +0 -1
- package/dist/esm/lib/algorithms/md5-wasm.js +0 -470
- package/dist/esm/lib/algorithms/md5-wasm.js.map +0 -1
- package/dist/esm/lib/crc32-hash.js +0 -56
- package/dist/esm/lib/crc32-hash.js.map +0 -1
- package/dist/esm/lib/crc32c-hash.js +0 -55
- package/dist/esm/lib/crc32c-hash.js.map +0 -1
- package/dist/esm/lib/crypto-hash.js +0 -76
- package/dist/esm/lib/crypto-hash.js.map +0 -1
- package/dist/esm/lib/hash.js +0 -38
- package/dist/esm/lib/hash.js.map +0 -1
- package/dist/esm/lib/md5-hash.js +0 -23
- package/dist/esm/lib/md5-hash.js.map +0 -1
- package/dist/esm/lib/node-hash.js +0 -52
- package/dist/esm/lib/node-hash.js.map +0 -1
- package/dist/esm/lib/sha256-hash.js +0 -12
- package/dist/esm/lib/sha256-hash.js.map +0 -1
- package/dist/esm/lib/utils/base64-utils.js +0 -62
- package/dist/esm/lib/utils/base64-utils.js.map +0 -1
- package/dist/esm/lib/utils/digest-utils.js +0 -15
- package/dist/esm/lib/utils/digest-utils.js.map +0 -1
- package/dist/esm/types.js +0 -2
- package/dist/esm/types.js.map +0 -1
- package/dist/esm/workers/cryptojs-worker.ts.disabled +0 -26
- package/dist/esm/workers/worker.js +0 -25
- package/dist/esm/workers/worker.js.map +0 -1
package/dist/lib/md5-hash.js
CHANGED
|
@@ -1,32 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
* @returns base64 encoded hash
|
|
23
|
-
*/
|
|
24
|
-
async hash(input) {
|
|
25
|
-
const md5Promise = new Promise((resolve, reject) =>
|
|
26
|
-
// @ts-expect-error
|
|
27
|
-
(0, md5_wasm_1.default)(input).then(resolve).catch(reject));
|
|
28
|
-
const hex = await md5Promise;
|
|
29
|
-
return (0, digest_utils_1.hexToBase64)(hex);
|
|
30
|
-
}
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import { Hash } from './hash';
|
|
3
|
+
import md5WASM from './algorithms/md5-wasm';
|
|
4
|
+
import { hexToBase64 } from './utils/digest-utils';
|
|
5
|
+
export class MD5Hash extends Hash {
|
|
6
|
+
constructor(options = {}) {
|
|
7
|
+
super();
|
|
8
|
+
|
|
9
|
+
_defineProperty(this, "name", 'md5');
|
|
10
|
+
|
|
11
|
+
_defineProperty(this, "options", void 0);
|
|
12
|
+
|
|
13
|
+
this.options = options;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
async hash(input) {
|
|
17
|
+
const md5Promise = new Promise((resolve, reject) => md5WASM(input).then(resolve).catch(reject));
|
|
18
|
+
const hex = await md5Promise;
|
|
19
|
+
return hexToBase64(hex);
|
|
20
|
+
}
|
|
21
|
+
|
|
31
22
|
}
|
|
32
|
-
|
|
23
|
+
//# sourceMappingURL=md5-hash.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/md5-hash.ts"],"names":["Hash","md5WASM","hexToBase64","MD5Hash","constructor","options","hash","input","md5Promise","Promise","resolve","reject","then","catch","hex"],"mappings":";AACA,SAAQA,IAAR,QAAmB,QAAnB;AACA,OAAOC,OAAP,MAAoB,uBAApB;AACA,SAAQC,WAAR,QAA0B,sBAA1B;AAKA,OAAO,MAAMC,OAAN,SAAsBH,IAAtB,CAA2B;AAIhCI,EAAAA,WAAW,CAACC,OAAO,GAAG,EAAX,EAAe;AACxB;;AADwB,kCAHV,KAGU;;AAAA;;AAExB,SAAKA,OAAL,GAAeA,OAAf;AACD;;AAMS,QAAJC,IAAI,CAACC,KAAD,EAAsC;AAC9C,UAAMC,UAAU,GAAG,IAAIC,OAAJ,CAAoB,CAACC,OAAD,EAAUC,MAAV,KAErCV,OAAO,CAACM,KAAD,CAAP,CAAeK,IAAf,CAAoBF,OAApB,EAA6BG,KAA7B,CAAmCF,MAAnC,CAFiB,CAAnB;AAIA,UAAMG,GAAG,GAAG,MAAMN,UAAlB;AACA,WAAON,WAAW,CAACY,GAAD,CAAlB;AACD;;AApB+B","sourcesContent":["// Fork of https://github.com/briantbutton/md5-wasm under MIT license\nimport {Hash} from './hash';\nimport md5WASM from './algorithms/md5-wasm';\nimport {hexToBase64} from './utils/digest-utils';\n\n/**\n * A transform that calculates MD5 hashes, passing data through\n */\nexport class MD5Hash extends Hash {\n readonly name = 'md5';\n readonly options;\n\n constructor(options = {}) {\n super();\n this.options = options;\n }\n\n /**\n * Atomic hash calculation\n * @returns base64 encoded hash\n */\n async hash(input: ArrayBuffer): Promise<string> {\n const md5Promise = new Promise<string>((resolve, reject) =>\n // @ts-expect-error\n md5WASM(input).then(resolve).catch(reject)\n );\n const hex = await md5Promise;\n return hexToBase64(hex);\n }\n}\n"],"file":"md5-hash.js"}
|
package/dist/lib/node-hash.js
CHANGED
|
@@ -1,42 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import { Hash } from './hash';
|
|
3
|
+
import { createHash } from 'crypto';
|
|
4
|
+
export class NodeHash extends Hash {
|
|
5
|
+
constructor(options) {
|
|
6
|
+
var _this$options, _this$options$crypto;
|
|
7
|
+
|
|
8
|
+
super();
|
|
9
|
+
|
|
10
|
+
_defineProperty(this, "name", 'crypto-node');
|
|
11
|
+
|
|
12
|
+
_defineProperty(this, "options", void 0);
|
|
13
|
+
|
|
14
|
+
_defineProperty(this, "_algorithm", void 0);
|
|
15
|
+
|
|
16
|
+
_defineProperty(this, "_hash", void 0);
|
|
17
|
+
|
|
18
|
+
this.options = options;
|
|
19
|
+
|
|
20
|
+
if (!((_this$options = this.options) !== null && _this$options !== void 0 && (_this$options$crypto = _this$options.crypto) !== null && _this$options$crypto !== void 0 && _this$options$crypto.algorithm)) {
|
|
21
|
+
throw new Error(this.name);
|
|
19
22
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async hash(input) {
|
|
26
|
+
var _this$options2, _this$options2$crypto, _this$options2$crypto2;
|
|
27
|
+
|
|
28
|
+
await this.preload();
|
|
29
|
+
const hash = createHash((_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : (_this$options2$crypto = _this$options2.crypto) === null || _this$options2$crypto === void 0 ? void 0 : (_this$options2$crypto2 = _this$options2$crypto.algorithm) === null || _this$options2$crypto2 === void 0 ? void 0 : _this$options2$crypto2.toLowerCase());
|
|
30
|
+
const inputArray = new Uint8Array(input);
|
|
31
|
+
return hash.update(inputArray).digest('base64');
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async *hashBatches(asyncIterator) {
|
|
35
|
+
var _this$options3, _this$options3$crypto, _this$options3$crypto2, _this$options4, _this$options4$crypto, _this$options4$crypto2;
|
|
36
|
+
|
|
37
|
+
await this.preload();
|
|
38
|
+
const hash = createHash((_this$options3 = this.options) === null || _this$options3 === void 0 ? void 0 : (_this$options3$crypto = _this$options3.crypto) === null || _this$options3$crypto === void 0 ? void 0 : (_this$options3$crypto2 = _this$options3$crypto.algorithm) === null || _this$options3$crypto2 === void 0 ? void 0 : _this$options3$crypto2.toLowerCase());
|
|
39
|
+
|
|
40
|
+
for await (const chunk of asyncIterator) {
|
|
41
|
+
const inputArray = new Uint8Array(chunk);
|
|
42
|
+
hash.update(inputArray);
|
|
43
|
+
yield chunk;
|
|
40
44
|
}
|
|
45
|
+
|
|
46
|
+
(_this$options4 = this.options) === null || _this$options4 === void 0 ? void 0 : (_this$options4$crypto = _this$options4.crypto) === null || _this$options4$crypto === void 0 ? void 0 : (_this$options4$crypto2 = _this$options4$crypto.onEnd) === null || _this$options4$crypto2 === void 0 ? void 0 : _this$options4$crypto2.call(_this$options4$crypto, {
|
|
47
|
+
hash: hash.digest('base64')
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
41
51
|
}
|
|
42
|
-
|
|
52
|
+
//# sourceMappingURL=node-hash.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/node-hash.ts"],"names":["Hash","createHash","NodeHash","constructor","options","crypto","algorithm","Error","name","hash","input","preload","toLowerCase","inputArray","Uint8Array","update","digest","hashBatches","asyncIterator","chunk","onEnd"],"mappings":";AACA,SAAQA,IAAR,QAAmB,QAAnB;AACA,SAAQC,UAAR,QAAyB,QAAzB;AAaA,OAAO,MAAMC,QAAN,SAAuBF,IAAvB,CAA4B;AASjCG,EAAAA,WAAW,CAACC,OAAD,EAA6B;AAAA;;AACtC;;AADsC,kCARxB,aAQwB;;AAAA;;AAAA;;AAAA;;AAEtC,SAAKA,OAAL,GAAeA,OAAf;;AACA,QAAI,mBAAC,KAAKA,OAAN,kEAAC,cAAcC,MAAf,iDAAC,qBAAsBC,SAAvB,CAAJ,EAAsC;AACpC,YAAM,IAAIC,KAAJ,CAAU,KAAKC,IAAf,CAAN;AACD;AACF;;AAMS,QAAJC,IAAI,CAACC,KAAD,EAAsC;AAAA;;AAC9C,UAAM,KAAKC,OAAL,EAAN;AACA,UAAMF,IAAI,GAAGR,UAAU,mBAAC,KAAKG,OAAN,4EAAC,eAAcC,MAAf,oFAAC,sBAAsBC,SAAvB,2DAAC,uBAAiCM,WAAjC,EAAD,CAAvB;AACA,UAAMC,UAAU,GAAG,IAAIC,UAAJ,CAAeJ,KAAf,CAAnB;AACA,WAAOD,IAAI,CAACM,MAAL,CAAYF,UAAZ,EAAwBG,MAAxB,CAA+B,QAA/B,CAAP;AACD;;AAEiB,SAAXC,WAAW,CAChBC,aADgB,EAEY;AAAA;;AAC5B,UAAM,KAAKP,OAAL,EAAN;AACA,UAAMF,IAAI,GAAGR,UAAU,mBAAC,KAAKG,OAAN,4EAAC,eAAcC,MAAf,oFAAC,sBAAsBC,SAAvB,2DAAC,uBAAiCM,WAAjC,EAAD,CAAvB;;AACA,eAAW,MAAMO,KAAjB,IAA0BD,aAA1B,EAAyC;AAEvC,YAAML,UAAU,GAAG,IAAIC,UAAJ,CAAeK,KAAf,CAAnB;AACAV,MAAAA,IAAI,CAACM,MAAL,CAAYF,UAAZ;AACA,YAAMM,KAAN;AACD;;AACD,2BAAKf,OAAL,2FAAcC,MAAd,0GAAsBe,KAAtB,8GAA8B;AAACX,MAAAA,IAAI,EAAEA,IAAI,CAACO,MAAL,CAAY,QAAZ;AAAP,KAA9B;AACD;;AAxCgC","sourcesContent":["// This dependency is too big, application must provide it\nimport {Hash} from './hash';\nimport {createHash} from 'crypto'; // Node.js builtin\n\ntype CryptoHashOptions = {\n crypto: {\n algorithm: string;\n onEnd?: (result: {hash: string}) => any;\n };\n};\n\n/**\n * Calculates Cryptographic Hash using Node.js crypto library\n * @deprecated Warning, experimental class\n */\nexport class NodeHash extends Hash {\n readonly name = 'crypto-node';\n\n options: CryptoHashOptions;\n // @ts-ignore\n private _algorithm;\n // @ts-ignore\n private _hash;\n\n constructor(options: CryptoHashOptions) {\n super();\n this.options = options;\n if (!this.options?.crypto?.algorithm) {\n throw new Error(this.name);\n }\n }\n\n /**\n * Atomic hash calculation\n * @returns base64 encoded hash\n */\n async hash(input: ArrayBuffer): Promise<string> {\n await this.preload();\n const hash = createHash(this.options?.crypto?.algorithm?.toLowerCase());\n const inputArray = new Uint8Array(input);\n return hash.update(inputArray).digest('base64');\n }\n\n async *hashBatches(\n asyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>\n ): AsyncIterable<ArrayBuffer> {\n await this.preload();\n const hash = createHash(this.options?.crypto?.algorithm?.toLowerCase());\n for await (const chunk of asyncIterator) {\n // https://stackoverflow.com/questions/25567468/how-to-decrypt-an-arraybuffer\n const inputArray = new Uint8Array(chunk);\n hash.update(inputArray);\n yield chunk;\n }\n this.options?.crypto?.onEnd?.({hash: hash.digest('base64')});\n }\n}\n"],"file":"node-hash.js"}
|
package/dist/lib/sha256-hash.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
super({ ...options, crypto: { ...options.crypto, algorithm: 'SHA256' } });
|
|
12
|
-
}
|
|
1
|
+
import { CryptoHash } from './crypto-hash';
|
|
2
|
+
export class SHA256Hash extends CryptoHash {
|
|
3
|
+
constructor(options) {
|
|
4
|
+
super({ ...options,
|
|
5
|
+
crypto: { ...options.crypto,
|
|
6
|
+
algorithm: 'SHA256'
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
|
|
13
11
|
}
|
|
14
|
-
|
|
12
|
+
//# sourceMappingURL=sha256-hash.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/sha256-hash.ts"],"names":["CryptoHash","SHA256Hash","constructor","options","crypto","algorithm"],"mappings":"AACA,SAAQA,UAAR,QAAyB,eAAzB;AAYA,OAAO,MAAMC,UAAN,SAAyBD,UAAzB,CAAoC;AACzCE,EAAAA,WAAW,CAACC,OAAD,EAA6B;AACtC,UAAM,EAAC,GAAGA,OAAJ;AAAaC,MAAAA,MAAM,EAAE,EAAC,GAAGD,OAAO,CAACC,MAAZ;AAAoBC,QAAAA,SAAS,EAAE;AAA/B;AAArB,KAAN;AACD;;AAHwC","sourcesContent":["//\nimport {CryptoHash} from './crypto-hash';\n\ntype CryptoHashOptions = {\n modules: {[moduleName: string]: any};\n crypto?: {\n onEnd?: (result: {hash: string}) => any;\n };\n};\n\n/**\n * A transform that calculates Cryptographic Hash\n */\nexport class SHA256Hash extends CryptoHash {\n constructor(options: CryptoHashOptions) {\n super({...options, crypto: {...options.crypto, algorithm: 'SHA256'}});\n }\n}\n"],"file":"sha256-hash.js"}
|
|
@@ -1,67 +1,62 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*/
|
|
8
|
-
function toBase64(string) {
|
|
9
|
-
// String conversion as required by Web IDL.
|
|
10
|
-
string = `${string}`;
|
|
11
|
-
// "The btoa() method must throw an "InvalidCharacterError" DOMException if
|
|
12
|
-
// data contains any character whose code point is greater than U+00FF."
|
|
13
|
-
for (let i = 0; i < string.length; i++) {
|
|
14
|
-
if (string.charCodeAt(i) > 255) {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
1
|
+
export function toBase64(string) {
|
|
2
|
+
string = "".concat(string);
|
|
3
|
+
|
|
4
|
+
for (let i = 0; i < string.length; i++) {
|
|
5
|
+
if (string.charCodeAt(i) > 255) {
|
|
6
|
+
return null;
|
|
17
7
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
groupsOfSix[2] |= string.charCodeAt(i + 2) >> 6;
|
|
31
|
-
groupsOfSix[3] = string.charCodeAt(i + 2) & 0x3f;
|
|
32
|
-
}
|
|
33
|
-
for (let j = 0; j < groupsOfSix.length; j++) {
|
|
34
|
-
if (typeof groupsOfSix[j] === 'undefined') {
|
|
35
|
-
out += '=';
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
out += btoaLookup(groupsOfSix[j]);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
let out = '';
|
|
11
|
+
|
|
12
|
+
for (let i = 0; i < string.length; i += 3) {
|
|
13
|
+
const groupsOfSix = [undefined, undefined, undefined, undefined];
|
|
14
|
+
groupsOfSix[0] = string.charCodeAt(i) >> 2;
|
|
15
|
+
groupsOfSix[1] = (string.charCodeAt(i) & 0x03) << 4;
|
|
16
|
+
|
|
17
|
+
if (string.length > i + 1) {
|
|
18
|
+
groupsOfSix[1] |= string.charCodeAt(i + 1) >> 4;
|
|
19
|
+
groupsOfSix[2] = (string.charCodeAt(i + 1) & 0x0f) << 2;
|
|
41
20
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
* Lookup table for btoa(), which converts a six-bit number into the
|
|
47
|
-
* corresponding ASCII character.
|
|
48
|
-
*/
|
|
49
|
-
function btoaLookup(idx) {
|
|
50
|
-
if (idx < 26) {
|
|
51
|
-
return String.fromCharCode(idx + 'A'.charCodeAt(0));
|
|
52
|
-
}
|
|
53
|
-
if (idx < 52) {
|
|
54
|
-
return String.fromCharCode(idx - 26 + 'a'.charCodeAt(0));
|
|
55
|
-
}
|
|
56
|
-
if (idx < 62) {
|
|
57
|
-
return String.fromCharCode(idx - 52 + '0'.charCodeAt(0));
|
|
21
|
+
|
|
22
|
+
if (string.length > i + 2) {
|
|
23
|
+
groupsOfSix[2] |= string.charCodeAt(i + 2) >> 6;
|
|
24
|
+
groupsOfSix[3] = string.charCodeAt(i + 2) & 0x3f;
|
|
58
25
|
}
|
|
59
|
-
|
|
60
|
-
|
|
26
|
+
|
|
27
|
+
for (let j = 0; j < groupsOfSix.length; j++) {
|
|
28
|
+
if (typeof groupsOfSix[j] === 'undefined') {
|
|
29
|
+
out += '=';
|
|
30
|
+
} else {
|
|
31
|
+
out += btoaLookup(groupsOfSix[j]);
|
|
32
|
+
}
|
|
61
33
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return out;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function btoaLookup(idx) {
|
|
40
|
+
if (idx < 26) {
|
|
41
|
+
return String.fromCharCode(idx + 'A'.charCodeAt(0));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (idx < 52) {
|
|
45
|
+
return String.fromCharCode(idx - 26 + 'a'.charCodeAt(0));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (idx < 62) {
|
|
49
|
+
return String.fromCharCode(idx - 52 + '0'.charCodeAt(0));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (idx === 62) {
|
|
53
|
+
return '+';
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (idx === 63) {
|
|
57
|
+
return '/';
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return undefined;
|
|
67
61
|
}
|
|
62
|
+
//# sourceMappingURL=base64-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/utils/base64-utils.ts"],"names":["toBase64","string","i","length","charCodeAt","out","groupsOfSix","undefined","j","btoaLookup","idx","String","fromCharCode"],"mappings":"AAIA,OAAO,SAASA,QAAT,CAAkBC,MAAlB,EAAiD;AAEtDA,EAAAA,MAAM,aAAMA,MAAN,CAAN;;AAGA,OAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGD,MAAM,CAACE,MAA3B,EAAmCD,CAAC,EAApC,EAAwC;AACtC,QAAID,MAAM,CAACG,UAAP,CAAkBF,CAAlB,IAAuB,GAA3B,EAAgC;AAC9B,aAAO,IAAP;AACD;AACF;;AACD,MAAIG,GAAG,GAAG,EAAV;;AACA,OAAK,IAAIH,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGD,MAAM,CAACE,MAA3B,EAAmCD,CAAC,IAAI,CAAxC,EAA2C;AAEzC,UAAMI,WAAmC,GAAG,CAACC,SAAD,EAAYA,SAAZ,EAAuBA,SAAvB,EAAkCA,SAAlC,CAA5C;AACAD,IAAAA,WAAW,CAAC,CAAD,CAAX,GAAiBL,MAAM,CAACG,UAAP,CAAkBF,CAAlB,KAAwB,CAAzC;AACAI,IAAAA,WAAW,CAAC,CAAD,CAAX,GAAiB,CAACL,MAAM,CAACG,UAAP,CAAkBF,CAAlB,IAAuB,IAAxB,KAAiC,CAAlD;;AACA,QAAID,MAAM,CAACE,MAAP,GAAgBD,CAAC,GAAG,CAAxB,EAA2B;AACzBI,MAAAA,WAAW,CAAC,CAAD,CAAX,IAAkBL,MAAM,CAACG,UAAP,CAAkBF,CAAC,GAAG,CAAtB,KAA4B,CAA9C;AACAI,MAAAA,WAAW,CAAC,CAAD,CAAX,GAAiB,CAACL,MAAM,CAACG,UAAP,CAAkBF,CAAC,GAAG,CAAtB,IAA2B,IAA5B,KAAqC,CAAtD;AACD;;AACD,QAAID,MAAM,CAACE,MAAP,GAAgBD,CAAC,GAAG,CAAxB,EAA2B;AAEzBI,MAAAA,WAAW,CAAC,CAAD,CAAX,IAAkBL,MAAM,CAACG,UAAP,CAAkBF,CAAC,GAAG,CAAtB,KAA4B,CAA9C;AACAI,MAAAA,WAAW,CAAC,CAAD,CAAX,GAAiBL,MAAM,CAACG,UAAP,CAAkBF,CAAC,GAAG,CAAtB,IAA2B,IAA5C;AACD;;AACD,SAAK,IAAIM,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGF,WAAW,CAACH,MAAhC,EAAwCK,CAAC,EAAzC,EAA6C;AAC3C,UAAI,OAAOF,WAAW,CAACE,CAAD,CAAlB,KAA0B,WAA9B,EAA2C;AACzCH,QAAAA,GAAG,IAAI,GAAP;AACD,OAFD,MAEO;AACLA,QAAAA,GAAG,IAAII,UAAU,CAACH,WAAW,CAACE,CAAD,CAAZ,CAAjB;AACD;AACF;AACF;;AACD,SAAOH,GAAP;AACD;;AAMD,SAASI,UAAT,CAAoBC,GAApB,EAAyB;AACvB,MAAIA,GAAG,GAAG,EAAV,EAAc;AACZ,WAAOC,MAAM,CAACC,YAAP,CAAoBF,GAAG,GAAG,IAAIN,UAAJ,CAAe,CAAf,CAA1B,CAAP;AACD;;AACD,MAAIM,GAAG,GAAG,EAAV,EAAc;AACZ,WAAOC,MAAM,CAACC,YAAP,CAAoBF,GAAG,GAAG,EAAN,GAAW,IAAIN,UAAJ,CAAe,CAAf,CAA/B,CAAP;AACD;;AACD,MAAIM,GAAG,GAAG,EAAV,EAAc;AACZ,WAAOC,MAAM,CAACC,YAAP,CAAoBF,GAAG,GAAG,EAAN,GAAW,IAAIN,UAAJ,CAAe,CAAf,CAA/B,CAAP;AACD;;AACD,MAAIM,GAAG,KAAK,EAAZ,EAAgB;AACd,WAAO,GAAP;AACD;;AACD,MAAIA,GAAG,KAAK,EAAZ,EAAgB;AACd,WAAO,GAAP;AACD;;AAED,SAAOH,SAAP;AACD","sourcesContent":["/**\n * `btoa()` polyfill as defined by the HTML and Infra specs, which mostly just references\n * RFC 4648.\n */\nexport function toBase64(string: string): string | null {\n // String conversion as required by Web IDL.\n string = `${string}`;\n // \"The btoa() method must throw an \"InvalidCharacterError\" DOMException if\n // data contains any character whose code point is greater than U+00FF.\"\n for (let i = 0; i < string.length; i++) {\n if (string.charCodeAt(i) > 255) {\n return null;\n }\n }\n let out = '';\n for (let i = 0; i < string.length; i += 3) {\n /** @type {Array[4]} */\n const groupsOfSix: (number | undefined)[] = [undefined, undefined, undefined, undefined];\n groupsOfSix[0] = string.charCodeAt(i) >> 2;\n groupsOfSix[1] = (string.charCodeAt(i) & 0x03) << 4;\n if (string.length > i + 1) {\n groupsOfSix[1] |= string.charCodeAt(i + 1) >> 4;\n groupsOfSix[2] = (string.charCodeAt(i + 1) & 0x0f) << 2;\n }\n if (string.length > i + 2) {\n // @ts-expect-error\n groupsOfSix[2] |= string.charCodeAt(i + 2) >> 6;\n groupsOfSix[3] = string.charCodeAt(i + 2) & 0x3f;\n }\n for (let j = 0; j < groupsOfSix.length; j++) {\n if (typeof groupsOfSix[j] === 'undefined') {\n out += '=';\n } else {\n out += btoaLookup(groupsOfSix[j]);\n }\n }\n }\n return out;\n}\n\n/**\n * Lookup table for btoa(), which converts a six-bit number into the\n * corresponding ASCII character.\n */\nfunction btoaLookup(idx) {\n if (idx < 26) {\n return String.fromCharCode(idx + 'A'.charCodeAt(0));\n }\n if (idx < 52) {\n return String.fromCharCode(idx - 26 + 'a'.charCodeAt(0));\n }\n if (idx < 62) {\n return String.fromCharCode(idx - 52 + '0'.charCodeAt(0));\n }\n if (idx === 62) {\n return '+';\n }\n if (idx === 63) {\n return '/';\n }\n // Throw INVALID_CHARACTER_ERR exception here -- won't be hit in the teststring.\n return undefined;\n}\n"],"file":"base64-utils.js"}
|
|
@@ -1,27 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
function toHex(cipher) {
|
|
9
|
-
const hexString = cipher.toString(16);
|
|
10
|
-
return hexString === '0' ? `0${hexString}` : hexString;
|
|
1
|
+
import { toBase64 } from './base64-utils';
|
|
2
|
+
export function toHex(cipher) {
|
|
3
|
+
const hexString = cipher.toString(16);
|
|
4
|
+
return hexString === '0' ? "0".concat(hexString) : hexString;
|
|
11
5
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
hexstring = `0${hexstring}`;
|
|
21
|
-
}
|
|
22
|
-
const matches = hexstring.match(/\w{2}/g) || [];
|
|
23
|
-
const string = matches.map((a) => String.fromCharCode(parseInt(a, 16))).join('');
|
|
24
|
-
// TODO - define how to handle failures
|
|
25
|
-
return (0, base64_utils_1.toBase64)(string) || '';
|
|
6
|
+
export function hexToBase64(hexstring) {
|
|
7
|
+
if (hexstring.length % 2 !== 0) {
|
|
8
|
+
hexstring = "0".concat(hexstring);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const matches = hexstring.match(/\w{2}/g) || [];
|
|
12
|
+
const string = matches.map(a => String.fromCharCode(parseInt(a, 16))).join('');
|
|
13
|
+
return toBase64(string) || '';
|
|
26
14
|
}
|
|
27
|
-
|
|
15
|
+
//# sourceMappingURL=digest-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/utils/digest-utils.ts"],"names":["toBase64","toHex","cipher","hexString","toString","hexToBase64","hexstring","length","matches","match","string","map","a","String","fromCharCode","parseInt","join"],"mappings":"AAAA,SAAQA,QAAR,QAAuB,gBAAvB;AAKA,OAAO,SAASC,KAAT,CAAeC,MAAf,EAAuC;AAC5C,QAAMC,SAAS,GAAGD,MAAM,CAACE,QAAP,CAAgB,EAAhB,CAAlB;AACA,SAAOD,SAAS,KAAK,GAAd,cAAwBA,SAAxB,IAAsCA,SAA7C;AACD;AAKD,OAAO,SAASE,WAAT,CAAqBC,SAArB,EAAgD;AAGrD,MAAIA,SAAS,CAACC,MAAV,GAAmB,CAAnB,KAAyB,CAA7B,EAAgC;AAC9BD,IAAAA,SAAS,cAAOA,SAAP,CAAT;AACD;;AACD,QAAME,OAAO,GAAGF,SAAS,CAACG,KAAV,CAAgB,QAAhB,KAA6B,EAA7C;AACA,QAAMC,MAAM,GAAGF,OAAO,CAACG,GAAR,CAAaC,CAAD,IAAOC,MAAM,CAACC,YAAP,CAAoBC,QAAQ,CAACH,CAAD,EAAI,EAAJ,CAA5B,CAAnB,EAAyDI,IAAzD,CAA8D,EAA9D,CAAf;AAEA,SAAOhB,QAAQ,CAACU,MAAD,CAAR,IAAoB,EAA3B;AACD","sourcesContent":["import {toBase64} from './base64-utils';\n\n/**\n *\n */\nexport function toHex(cipher: number): string {\n const hexString = cipher.toString(16);\n return hexString === '0' ? `0${hexString}` : hexString;\n}\n\n/**\n * @see https://stackoverflow.com/questions/23190056/hex-to-base64-converter-for-javascript\n */\nexport function hexToBase64(hexstring: string): string {\n // Add leading zero to keep even count of digits\n // eg. f85d741 => 0f85d741\n if (hexstring.length % 2 !== 0) {\n hexstring = `0${hexstring}`;\n }\n const matches = hexstring.match(/\\w{2}/g) || [];\n const string = matches.map((a) => String.fromCharCode(parseInt(a, 16))).join('');\n // TODO - define how to handle failures\n return toBase64(string) || '';\n}\n"],"file":"digest-utils.js"}
|
package/dist/types.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export {};
|
|
2
|
+
//# sourceMappingURL=types.js.map
|
|
File without changes
|
|
File without changes
|
package/dist/workers/worker.js
CHANGED
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
import { createWorker } from '@loaders.gl/worker-utils';
|
|
2
|
+
import { CRC32Hash } from '../lib/crc32-hash';
|
|
3
|
+
import { CRC32CHash } from '../lib/crc32c-hash';
|
|
4
|
+
import { MD5Hash } from '../lib/md5-hash';
|
|
5
|
+
export { CRC32Hash, CRC32CHash };
|
|
6
|
+
createWorker(async (data, options = {}) => {
|
|
7
|
+
const {
|
|
8
|
+
operation
|
|
9
|
+
} = options;
|
|
10
|
+
|
|
11
|
+
switch (operation) {
|
|
12
|
+
case 'crc32':
|
|
13
|
+
return await new CRC32Hash(options).hash(data);
|
|
14
|
+
|
|
15
|
+
case 'crc32c':
|
|
16
|
+
return await new CRC32CHash(options).hash(data);
|
|
17
|
+
|
|
18
|
+
case 'md5':
|
|
19
|
+
return await new MD5Hash(options).hash(data);
|
|
20
|
+
|
|
21
|
+
default:
|
|
22
|
+
throw new Error("invalid option: ".concat(operation));
|
|
23
|
+
}
|
|
23
24
|
});
|
|
25
|
+
//# sourceMappingURL=worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/workers/worker.ts"],"names":["createWorker","CRC32Hash","CRC32CHash","MD5Hash","data","options","operation","hash","Error"],"mappings":"AAAA,SAAQA,YAAR,QAA2B,0BAA3B;AACA,SAAQC,SAAR,QAAwB,mBAAxB;AACA,SAAQC,UAAR,QAAyB,oBAAzB;AACA,SAAQC,OAAR,QAAsB,iBAAtB;AAGA,SAAQF,SAAR,EAAmBC,UAAnB;AAEAF,YAAY,CAAC,OAAOI,IAAP,EAAaC,OAAO,GAAG,EAAvB,KAA8B;AAEzC,QAAM;AAACC,IAAAA;AAAD,MAAcD,OAApB;;AAEA,UAAQC,SAAR;AACE,SAAK,OAAL;AACE,aAAO,MAAM,IAAIL,SAAJ,CAAcI,OAAd,EAAuBE,IAAvB,CAA4BH,IAA5B,CAAb;;AACF,SAAK,QAAL;AACE,aAAO,MAAM,IAAIF,UAAJ,CAAeG,OAAf,EAAwBE,IAAxB,CAA6BH,IAA7B,CAAb;;AACF,SAAK,KAAL;AACE,aAAO,MAAM,IAAID,OAAJ,CAAYE,OAAZ,EAAqBE,IAArB,CAA0BH,IAA1B,CAAb;;AACF;AACE,YAAM,IAAII,KAAJ,2BAA6BF,SAA7B,EAAN;AARJ;AAUD,CAdW,CAAZ","sourcesContent":["import {createWorker} from '@loaders.gl/worker-utils';\nimport {CRC32Hash} from '../lib/crc32-hash';\nimport {CRC32CHash} from '../lib/crc32c-hash';\nimport {MD5Hash} from '../lib/md5-hash';\n\n// Assuming we can bundle as module\nexport {CRC32Hash, CRC32CHash};\n\ncreateWorker(async (data, options = {}) => {\n // @ts-ignore\n const {operation} = options;\n\n switch (operation) {\n case 'crc32':\n return await new CRC32Hash(options).hash(data);\n case 'crc32c':\n return await new CRC32CHash(options).hash(data);\n case 'md5':\n return await new MD5Hash(options).hash(data);\n default:\n throw new Error(`invalid option: ${operation}`);\n }\n});\n"],"file":"worker.js"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/crypto",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-alpha.5",
|
|
4
4
|
"description": "Cryptographic/hashing plugins for loaders.gl",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"point cloud"
|
|
19
19
|
],
|
|
20
20
|
"types": "dist/index.d.ts",
|
|
21
|
-
"main": "dist/
|
|
22
|
-
"module": "dist/
|
|
21
|
+
"main": "dist/index.js",
|
|
22
|
+
"module": "dist/index.js",
|
|
23
23
|
"sideEffects": false,
|
|
24
24
|
"files": [
|
|
25
25
|
"src",
|
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
"scripts": {
|
|
30
30
|
"pre-build": "npm run build-worker && npm run build-bundle",
|
|
31
31
|
"build-bundle": "esbuild src/bundle.ts --outfile=dist/dist.min.js --bundle --minify --sourcemap",
|
|
32
|
-
"build-worker": "esbuild src/workers/worker.ts --outfile=dist/worker.js --bundle --minify --sourcemap"
|
|
32
|
+
"build-worker": "esbuild src/workers/worker.ts --outfile=dist/worker.js --bundle --minify --sourcemap --define:__VERSION__=\\\"$npm_package_version\\\""
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@babel/runtime": "^7.3.1",
|
|
36
|
-
"@loaders.gl/loader-utils": "
|
|
37
|
-
"@loaders.gl/worker-utils": "
|
|
36
|
+
"@loaders.gl/loader-utils": "4.0.0-alpha.5",
|
|
37
|
+
"@loaders.gl/worker-utils": "4.0.0-alpha.5",
|
|
38
38
|
"@types/crypto-js": "^4.0.1"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"crypto": false,
|
|
45
45
|
"sse4_crc32": false
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "7a71a54bdf1ddf985cc3af3db90b82e7fa97d025"
|
|
48
48
|
}
|
package/dist/es5/bundle.js
DELETED
package/dist/es5/bundle.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/bundle.ts"],"names":["moduleExports","require","globalThis","loaders","module","exports","Object","assign"],"mappings":";;AACA,IAAMA,aAAa,GAAGC,OAAO,CAAC,SAAD,CAA7B;;AACAC,UAAU,CAACC,OAAX,GAAqBD,UAAU,CAACC,OAAX,IAAsB,EAA3C;AACAC,MAAM,CAACC,OAAP,GAAiBC,MAAM,CAACC,MAAP,CAAcL,UAAU,CAACC,OAAzB,EAAkCH,aAAlC,CAAjB","sourcesContent":["// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.loaders = globalThis.loaders || {};\nmodule.exports = Object.assign(globalThis.loaders, moduleExports);\n"],"file":"bundle.js"}
|
package/dist/es5/index.js
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "CRC32Hash", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _crc32Hash.CRC32Hash;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "CRC32CHash", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function get() {
|
|
15
|
-
return _crc32cHash.CRC32CHash;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "MD5Hash", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function get() {
|
|
21
|
-
return _md5Hash.MD5Hash;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(exports, "SHA256Hash", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function get() {
|
|
27
|
-
return _sha256Hash.SHA256Hash;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(exports, "CryptoHash", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function get() {
|
|
33
|
-
return _cryptoHash.CryptoHash;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
Object.defineProperty(exports, "NodeHash", {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
get: function get() {
|
|
39
|
-
return _nodeHash.NodeHash;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
Object.defineProperty(exports, "_hexToBase64", {
|
|
43
|
-
enumerable: true,
|
|
44
|
-
get: function get() {
|
|
45
|
-
return _digestUtils.hexToBase64;
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
Object.defineProperty(exports, "_toHex", {
|
|
49
|
-
enumerable: true,
|
|
50
|
-
get: function get() {
|
|
51
|
-
return _digestUtils.toHex;
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
exports.CryptoJSWorker = exports.CryptoWorker = void 0;
|
|
55
|
-
|
|
56
|
-
var _crc32Hash = require("./lib/crc32-hash");
|
|
57
|
-
|
|
58
|
-
var _crc32cHash = require("./lib/crc32c-hash");
|
|
59
|
-
|
|
60
|
-
var _md5Hash = require("./lib/md5-hash");
|
|
61
|
-
|
|
62
|
-
var _sha256Hash = require("./lib/sha256-hash");
|
|
63
|
-
|
|
64
|
-
var _cryptoHash = require("./lib/crypto-hash");
|
|
65
|
-
|
|
66
|
-
var _nodeHash = require("./lib/node-hash");
|
|
67
|
-
|
|
68
|
-
var _digestUtils = require("./lib/utils/digest-utils");
|
|
69
|
-
|
|
70
|
-
var VERSION = typeof "3.1.3" !== 'undefined' ? "3.1.3" : 'latest';
|
|
71
|
-
var CryptoWorker = {
|
|
72
|
-
id: 'crypto',
|
|
73
|
-
name: 'CRC32, CRC32c and MD5 Hashes',
|
|
74
|
-
module: 'crypto',
|
|
75
|
-
version: VERSION,
|
|
76
|
-
options: {
|
|
77
|
-
crypto: {}
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
exports.CryptoWorker = CryptoWorker;
|
|
81
|
-
var CryptoJSWorker = {
|
|
82
|
-
id: 'cryptojs',
|
|
83
|
-
name: 'Cryptographic Hashes',
|
|
84
|
-
module: 'crypto',
|
|
85
|
-
version: VERSION,
|
|
86
|
-
options: {
|
|
87
|
-
cryptojs: {}
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
exports.CryptoJSWorker = CryptoJSWorker;
|
|
91
|
-
//# sourceMappingURL=index.js.map
|
package/dist/es5/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"names":["VERSION","CryptoWorker","id","name","module","version","options","crypto","CryptoJSWorker","cryptojs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AAEA;;AAIA,IAAMA,OAAO,GAAG,mBAAuB,WAAvB,aAAmD,QAAnE;AAKO,IAAMC,YAAY,GAAG;AAC1BC,EAAAA,EAAE,EAAE,QADsB;AAE1BC,EAAAA,IAAI,EAAE,8BAFoB;AAG1BC,EAAAA,MAAM,EAAE,QAHkB;AAI1BC,EAAAA,OAAO,EAAEL,OAJiB;AAK1BM,EAAAA,OAAO,EAAE;AACPC,IAAAA,MAAM,EAAE;AADD;AALiB,CAArB;;AAcA,IAAMC,cAAc,GAAG;AAC5BN,EAAAA,EAAE,EAAE,UADwB;AAE5BC,EAAAA,IAAI,EAAE,sBAFsB;AAG5BC,EAAAA,MAAM,EAAE,QAHoB;AAI5BC,EAAAA,OAAO,EAAEL,OAJmB;AAK5BM,EAAAA,OAAO,EAAE;AACPG,IAAAA,QAAQ,EAAE;AADH;AALmB,CAAvB","sourcesContent":["// import type {WorkerObject} from '@loaders.gl/worker-utils';\n\nexport {CRC32Hash} from './lib/crc32-hash';\nexport {CRC32CHash} from './lib/crc32c-hash';\nexport {MD5Hash} from './lib/md5-hash';\nexport {SHA256Hash} from './lib/sha256-hash';\n\nexport {CryptoHash} from './lib/crypto-hash';\nexport {NodeHash} from './lib/node-hash';\n\nexport {hexToBase64 as _hexToBase64, toHex as _toHex} from './lib/utils/digest-utils';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\n/**\n * Small, fast worker for CRC32, CRC32c and MD5 Hashes\n */\nexport const CryptoWorker = {\n id: 'crypto',\n name: 'CRC32, CRC32c and MD5 Hashes',\n module: 'crypto',\n version: VERSION,\n options: {\n crypto: {}\n }\n};\n\n/**\n * Large worker for full complement of Cryptographic Hashes\n * bundles the full crypto.js library\n */\nexport const CryptoJSWorker = {\n id: 'cryptojs',\n name: 'Cryptographic Hashes',\n module: 'crypto',\n version: VERSION,\n options: {\n cryptojs: {}\n }\n};\n"],"file":"index.js"}
|