@loaders.gl/crypto 3.4.11 → 3.4.12

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/es5/index.js CHANGED
@@ -59,7 +59,7 @@ var _sha256Hash = require("./lib/sha256-hash");
59
59
  var _cryptoHash = require("./lib/crypto-hash");
60
60
  var _nodeHash = require("./lib/node-hash");
61
61
  var _digestUtils = require("./lib/utils/digest-utils");
62
- var VERSION = typeof "3.4.11" !== 'undefined' ? "3.4.11" : 'latest';
62
+ var VERSION = typeof "3.4.12" !== 'undefined' ? "3.4.12" : 'latest';
63
63
  var CryptoWorker = {
64
64
  id: 'crypto',
65
65
  name: 'CRC32, CRC32c and MD5 Hashes',
package/dist/esm/index.js CHANGED
@@ -5,7 +5,7 @@ export { SHA256Hash } from './lib/sha256-hash';
5
5
  export { CryptoHash } from './lib/crypto-hash';
6
6
  export { NodeHash } from './lib/node-hash';
7
7
  export { hexToBase64 as _hexToBase64, toHex as _toHex } from './lib/utils/digest-utils';
8
- const VERSION = typeof "3.4.11" !== 'undefined' ? "3.4.11" : 'latest';
8
+ const VERSION = typeof "3.4.12" !== 'undefined' ? "3.4.12" : 'latest';
9
9
  export const CryptoWorker = {
10
10
  id: 'crypto',
11
11
  name: 'CRC32, CRC32c and MD5 Hashes',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/crypto",
3
- "version": "3.4.11",
3
+ "version": "3.4.12",
4
4
  "description": "Cryptographic/hashing plugins for loaders.gl",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -33,8 +33,8 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@babel/runtime": "^7.3.1",
36
- "@loaders.gl/loader-utils": "3.4.11",
37
- "@loaders.gl/worker-utils": "3.4.11",
36
+ "@loaders.gl/loader-utils": "3.4.12",
37
+ "@loaders.gl/worker-utils": "3.4.12",
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": "2b8d490d2372e70dd89eef8f6b215a5205c16621"
47
+ "gitHead": "85254762ae3082f608a863291deef09f2b40c6cf"
48
48
  }
package/dist/bundle.js DELETED
@@ -1,5 +0,0 @@
1
- "use strict";
2
- // @ts-nocheck
3
- const moduleExports = require('./index');
4
- globalThis.loaders = globalThis.loaders || {};
5
- module.exports = Object.assign(globalThis.loaders, moduleExports);
package/dist/index.js DELETED
@@ -1,47 +0,0 @@
1
- "use strict";
2
- // import type {WorkerObject} from '@loaders.gl/worker-utils';
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.CryptoJSWorker = exports.CryptoWorker = exports._toHex = exports._hexToBase64 = exports.NodeHash = exports.CryptoHash = exports.SHA256Hash = exports.MD5Hash = exports.CRC32CHash = exports.CRC32Hash = void 0;
5
- var crc32_hash_1 = require("./lib/crc32-hash");
6
- Object.defineProperty(exports, "CRC32Hash", { enumerable: true, get: function () { return crc32_hash_1.CRC32Hash; } });
7
- var crc32c_hash_1 = require("./lib/crc32c-hash");
8
- Object.defineProperty(exports, "CRC32CHash", { enumerable: true, get: function () { return crc32c_hash_1.CRC32CHash; } });
9
- var md5_hash_1 = require("./lib/md5-hash");
10
- Object.defineProperty(exports, "MD5Hash", { enumerable: true, get: function () { return md5_hash_1.MD5Hash; } });
11
- var sha256_hash_1 = require("./lib/sha256-hash");
12
- Object.defineProperty(exports, "SHA256Hash", { enumerable: true, get: function () { return sha256_hash_1.SHA256Hash; } });
13
- var crypto_hash_1 = require("./lib/crypto-hash");
14
- Object.defineProperty(exports, "CryptoHash", { enumerable: true, get: function () { return crypto_hash_1.CryptoHash; } });
15
- var node_hash_1 = require("./lib/node-hash");
16
- Object.defineProperty(exports, "NodeHash", { enumerable: true, get: function () { return node_hash_1.NodeHash; } });
17
- var digest_utils_1 = require("./lib/utils/digest-utils");
18
- Object.defineProperty(exports, "_hexToBase64", { enumerable: true, get: function () { return digest_utils_1.hexToBase64; } });
19
- Object.defineProperty(exports, "_toHex", { enumerable: true, get: function () { return digest_utils_1.toHex; } });
20
- // __VERSION__ is injected by babel-plugin-version-inline
21
- // @ts-ignore TS2304: Cannot find name '__VERSION__'.
22
- const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
23
- /**
24
- * Small, fast worker for CRC32, CRC32c and MD5 Hashes
25
- */
26
- exports.CryptoWorker = {
27
- id: 'crypto',
28
- name: 'CRC32, CRC32c and MD5 Hashes',
29
- module: 'crypto',
30
- version: VERSION,
31
- options: {
32
- crypto: {}
33
- }
34
- };
35
- /**
36
- * Large worker for full complement of Cryptographic Hashes
37
- * bundles the full crypto.js library
38
- */
39
- exports.CryptoJSWorker = {
40
- id: 'cryptojs',
41
- name: 'Cryptographic Hashes',
42
- module: 'crypto',
43
- version: VERSION,
44
- options: {
45
- cryptojs: {}
46
- }
47
- };
@@ -1,30 +0,0 @@
1
- "use strict";
2
- // Inspired by https://gist.github.com/wqli78/1330293/6d85cc967f32cccfcbad94ae7d088a3dcfc14bd9
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- /**
5
- * Calculates the CRC32 checksum of a string.
6
- */
7
- class CRC32 {
8
- constructor() {
9
- this.crc = ~0;
10
- }
11
- update(arrayBuffer) {
12
- const CRC32_TABLE = getCRC32Table();
13
- const byteArray = new Uint8Array(arrayBuffer);
14
- for (let i = 0; i < byteArray.byteLength; i++) {
15
- this.crc = (this.crc >>> 8) ^ CRC32_TABLE[(this.crc ^ byteArray[i]) & 0xff];
16
- // strings: crc = (crc >>> 8) ^ CRC32TAB[(crc ^ str.charCodeAt(i)) & 0xff];
17
- }
18
- return this;
19
- }
20
- finalize() {
21
- this.crc = Math.abs(this.crc ^ -1);
22
- return this.crc;
23
- }
24
- }
25
- exports.default = CRC32;
26
- // Note: Using a typed array here doubles the speed of the cipher
27
- const CRC32TAB = Uint32Array.of(0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d);
28
- function getCRC32Table() {
29
- return CRC32TAB;
30
- }
@@ -1,38 +0,0 @@
1
- "use strict";
2
- // From: https://gist.github.com/wqli78/1330293/6d85cc967f32cccfcbad94ae7d088a3dcfc14bd9
3
- // CRC32 doesn't appear to be supported natively by crypto-js
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- // import {toBuffer} from '@loaders.gl/loader-utils';
6
- // import {calculate as sse4calculate} from 'sse4_crc32';
7
- /**
8
- * Calculates the CRC32C checksum of a string.
9
- */
10
- class CRC32C {
11
- constructor(options = {}) {
12
- this.options = options;
13
- this.crc = ~0;
14
- }
15
- update(arrayBuffer) {
16
- const byteArray = new Uint8Array(arrayBuffer);
17
- const CRC32_TABLE = getCRC32Table();
18
- for (let i = 0; i < byteArray.length; i++) {
19
- this.crc = CRC32_TABLE[(this.crc ^ byteArray[i]) & 0xff] ^ (this.crc >>> 8);
20
- }
21
- return this;
22
- }
23
- finalize() {
24
- this.crc = (this.crc ^ -1) >>> 0;
25
- return this.crc;
26
- }
27
- }
28
- exports.default = CRC32C;
29
- /**
30
- * This code is a manual javascript translation of c code generated by
31
- * pycrc 0.7.1 (http://www.tty1.net/pycrc/). Command line used:
32
- * './pycrc.py --model=crc-32c --generate c --algorithm=table-driven'
33
- */
34
- // Note: Using a typed array here doubles the speed of the cipher
35
- const CRC32C_TABLE = Int32Array.of(0x00000000, 0xf26b8303, 0xe13b70f7, 0x1350f3f4, 0xc79a971f, 0x35f1141c, 0x26a1e7e8, 0xd4ca64eb, 0x8ad958cf, 0x78b2dbcc, 0x6be22838, 0x9989ab3b, 0x4d43cfd0, 0xbf284cd3, 0xac78bf27, 0x5e133c24, 0x105ec76f, 0xe235446c, 0xf165b798, 0x030e349b, 0xd7c45070, 0x25afd373, 0x36ff2087, 0xc494a384, 0x9a879fa0, 0x68ec1ca3, 0x7bbcef57, 0x89d76c54, 0x5d1d08bf, 0xaf768bbc, 0xbc267848, 0x4e4dfb4b, 0x20bd8ede, 0xd2d60ddd, 0xc186fe29, 0x33ed7d2a, 0xe72719c1, 0x154c9ac2, 0x061c6936, 0xf477ea35, 0xaa64d611, 0x580f5512, 0x4b5fa6e6, 0xb93425e5, 0x6dfe410e, 0x9f95c20d, 0x8cc531f9, 0x7eaeb2fa, 0x30e349b1, 0xc288cab2, 0xd1d83946, 0x23b3ba45, 0xf779deae, 0x05125dad, 0x1642ae59, 0xe4292d5a, 0xba3a117e, 0x4851927d, 0x5b016189, 0xa96ae28a, 0x7da08661, 0x8fcb0562, 0x9c9bf696, 0x6ef07595, 0x417b1dbc, 0xb3109ebf, 0xa0406d4b, 0x522bee48, 0x86e18aa3, 0x748a09a0, 0x67dafa54, 0x95b17957, 0xcba24573, 0x39c9c670, 0x2a993584, 0xd8f2b687, 0x0c38d26c, 0xfe53516f, 0xed03a29b, 0x1f682198, 0x5125dad3, 0xa34e59d0, 0xb01eaa24, 0x42752927, 0x96bf4dcc, 0x64d4cecf, 0x77843d3b, 0x85efbe38, 0xdbfc821c, 0x2997011f, 0x3ac7f2eb, 0xc8ac71e8, 0x1c661503, 0xee0d9600, 0xfd5d65f4, 0x0f36e6f7, 0x61c69362, 0x93ad1061, 0x80fde395, 0x72966096, 0xa65c047d, 0x5437877e, 0x4767748a, 0xb50cf789, 0xeb1fcbad, 0x197448ae, 0x0a24bb5a, 0xf84f3859, 0x2c855cb2, 0xdeeedfb1, 0xcdbe2c45, 0x3fd5af46, 0x7198540d, 0x83f3d70e, 0x90a324fa, 0x62c8a7f9, 0xb602c312, 0x44694011, 0x5739b3e5, 0xa55230e6, 0xfb410cc2, 0x092a8fc1, 0x1a7a7c35, 0xe811ff36, 0x3cdb9bdd, 0xceb018de, 0xdde0eb2a, 0x2f8b6829, 0x82f63b78, 0x709db87b, 0x63cd4b8f, 0x91a6c88c, 0x456cac67, 0xb7072f64, 0xa457dc90, 0x563c5f93, 0x082f63b7, 0xfa44e0b4, 0xe9141340, 0x1b7f9043, 0xcfb5f4a8, 0x3dde77ab, 0x2e8e845f, 0xdce5075c, 0x92a8fc17, 0x60c37f14, 0x73938ce0, 0x81f80fe3, 0x55326b08, 0xa759e80b, 0xb4091bff, 0x466298fc, 0x1871a4d8, 0xea1a27db, 0xf94ad42f, 0x0b21572c, 0xdfeb33c7, 0x2d80b0c4, 0x3ed04330, 0xccbbc033, 0xa24bb5a6, 0x502036a5, 0x4370c551, 0xb11b4652, 0x65d122b9, 0x97baa1ba, 0x84ea524e, 0x7681d14d, 0x2892ed69, 0xdaf96e6a, 0xc9a99d9e, 0x3bc21e9d, 0xef087a76, 0x1d63f975, 0x0e330a81, 0xfc588982, 0xb21572c9, 0x407ef1ca, 0x532e023e, 0xa145813d, 0x758fe5d6, 0x87e466d5, 0x94b49521, 0x66df1622, 0x38cc2a06, 0xcaa7a905, 0xd9f75af1, 0x2b9cd9f2, 0xff56bd19, 0x0d3d3e1a, 0x1e6dcdee, 0xec064eed, 0xc38d26c4, 0x31e6a5c7, 0x22b65633, 0xd0ddd530, 0x0417b1db, 0xf67c32d8, 0xe52cc12c, 0x1747422f, 0x49547e0b, 0xbb3ffd08, 0xa86f0efc, 0x5a048dff, 0x8ecee914, 0x7ca56a17, 0x6ff599e3, 0x9d9e1ae0, 0xd3d3e1ab, 0x21b862a8, 0x32e8915c, 0xc083125f, 0x144976b4, 0xe622f5b7, 0xf5720643, 0x07198540, 0x590ab964, 0xab613a67, 0xb831c993, 0x4a5a4a90, 0x9e902e7b, 0x6cfbad78, 0x7fab5e8c, 0x8dc0dd8f, 0xe330a81a, 0x115b2b19, 0x020bd8ed, 0xf0605bee, 0x24aa3f05, 0xd6c1bc06, 0xc5914ff2, 0x37faccf1, 0x69e9f0d5, 0x9b8273d6, 0x88d28022, 0x7ab90321, 0xae7367ca, 0x5c18e4c9, 0x4f48173d, 0xbd23943e, 0xf36e6f75, 0x0105ec76, 0x12551f82, 0xe03e9c81, 0x34f4f86a, 0xc69f7b69, 0xd5cf889d, 0x27a40b9e, 0x79b737ba, 0x8bdcb4b9, 0x988c474d, 0x6ae7c44e, 0xbe2da0a5, 0x4c4623a6, 0x5f16d052, 0xad7d5351);
36
- function getCRC32Table() {
37
- return CRC32C_TABLE;
38
- }
@@ -1,435 +0,0 @@
1
- "use strict";
2
- /* eslint-disable */
3
- // @ts-nocheck
4
- /* !
5
- * MD5 WebAssembly
6
- * https://github.com/briantbutton/md5-wasm
7
- * (c) 2020 Brian Todd Button
8
- * Released under the MIT license
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- // *-*=* *=*-* *-*=* *=*-* *-*=* *=*-* *-*=* *=*-* *-*=* *=*-* *-*=* *=*-*
12
- // This contains two functions designed to achieve the same thing
13
- // -> A WebAssembly function for larger files
14
- // -> A JavaScript function for the others
15
- //
16
- const atb = typeof atob === 'function' ? atob : typeof Buffer === 'function' ? nodeATOB : identity, wasmB64 = atb('AGFzbQEAAAABDANgAX8AYAAAYAABfwIeAgdpbXBvcnRzA2xvZwAAB2ltcG9ydHMDbWVtAgABAzIxAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEAAAAAAAAAAAAAAAAAAAAAAgICAgIAAAAAAAaYARt/AUGBxpS6Bgt/AUGJ17b+fgt/AUH+uevFeQt/AUH2qMmBAQt/AUEAC38BQQALfwFBAAt/A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xBIQh0cmVGdWxsQiIIdHJlRnVsbEMjCHRyZUZ1bGxEJAhxdWFGdWxsQSUIcXVhRnVsbEImCHF1YUZ1bGxDJwhxdWFGdWxsRCgEZ2V0QSkEZ2V0QioEZ2V0QysEZ2V0RCwEZ2V0WC0Ec2V0QS4Ec2V0Qi8Ec2V0QzAEc2V0RDEEc2V0WALNATIAAQAAAQIAAAEIbnVtbG9vcHMCAAMABAAFAAYABwAIAAkACgALAAwADQAOAA8AEAARABIAEwAUABUAFgAXABgCAAABAW4ZAgAAAQFuGgIAAAEBbhsCAAABAW4cAgAAAQFuHQIAAAEBbh4CAAABAW4fAgAAAQFuIAIAAAEBbiECAAABAW4iAgAAAQFuIwIAAAEBbiQCAAABAW4lAgAAAQFuJgIAAAEBbicCAAABAW4oACkAKgArACwALQEAAC4BAAAvAQAAMAEAADEBAAA='), wasm = WebAssembly && atb !== identity ? str2AB(wasmB64).buffer : false, crypt = makeCrypt(), biteSize = 240 * 16 * 16, bounder = Math.floor(biteSize * 16 * 1.066666667), upperLimit = 268435456 - 65536, parmTypeErrStr = 'Parameter must be Buffer, ArrayBuffer or Uint8Array', tooBigErrStr = 'Parameter exceeds max size of 255.9 Mbytes';
17
- if (!wasm) {
18
- console.log('WebAssembly not available or WASM module could not be decoded; md5WASM will fall back to JavaScript');
19
- }
20
- // - - - - - - - - - - - - - - - - - - - - - - - - - - -
21
- // This returns a Promise-like object (I was farting around, so sue me)
22
- // which supports '.catch' and '.then'
23
- function md5WASM(data) {
24
- var mem, memView, importObj, imports, len, buff, thenFun, catchFun, result, endTime;
25
- const md5JS = makeMD5JS(), md5WA = makeMD5WA(), returnObj = {}, startTime = new Date().getTime();
26
- returnObj['then'] = function (fun) {
27
- thenFun = fun;
28
- getThen();
29
- return returnObj;
30
- };
31
- returnObj['catch'] = function (fun) {
32
- catchFun = fun;
33
- return returnObj;
34
- };
35
- // Sift the incoming parameter and the environment
36
- // If we are good, set buff
37
- if (true) {
38
- if (data && typeof data === 'object') {
39
- if (typeof Buffer === 'function' && data.constructor === Buffer) {
40
- buff = data;
41
- }
42
- else {
43
- if (data.constructor === Uint8Array || data.constructor === ArrayBuffer) {
44
- buff = data.constructor === ArrayBuffer ? new Uint8Array(data) : data;
45
- }
46
- else {
47
- getCatch(new TypeError(parmTypeErrStr));
48
- }
49
- }
50
- }
51
- else {
52
- getCatch(new TypeError(parmTypeErrStr));
53
- }
54
- }
55
- // - - - - - - - - - - - - - - - - - - - - - - - - - -
56
- // Make some choices based on the size of the incoming data
57
- // ~ Use WebAssembly or just JavaScript
58
- // ~ If Webassemly, allocate appropriate memory
59
- //
60
- if (buff) {
61
- len = buff.length;
62
- if (wasm && len > bounder) {
63
- if (len > upperLimit) {
64
- getCatch(new Error(tooBigErrStr));
65
- }
66
- else {
67
- mem = new WebAssembly.Memory({
68
- initial: len > 32000000 ? (len > 64000000 ? (len > 128000000 ? 4096 : 2048) : 1024) : 512
69
- });
70
- memView = new Uint32Array(mem.buffer);
71
- imports = { mem: mem, log: console.log };
72
- importObj = { imports };
73
- WebAssembly.instantiate(wasm, importObj).then(giterdone);
74
- }
75
- }
76
- else {
77
- getThen(md5JS(buff));
78
- }
79
- }
80
- return returnObj;
81
- function giterdone(obj) {
82
- getThen(md5WA(buff, obj.instance.exports, memView));
83
- }
84
- function getThen(r) {
85
- var res = Boolean(r) ? r : result;
86
- if (Boolean(r)) {
87
- endTime = new Date().getTime();
88
- }
89
- if (typeof thenFun === 'function') {
90
- if (Boolean(res)) {
91
- thenFun(res, endTime - startTime);
92
- thenFun = catchFun = null;
93
- }
94
- }
95
- else {
96
- if (Boolean(r)) {
97
- result = r;
98
- }
99
- }
100
- }
101
- function getCatch(err) {
102
- if (typeof catchFun === 'function') {
103
- catchFun(err);
104
- }
105
- }
106
- }
107
- exports.default = md5WASM;
108
- function makeMD5WA() {
109
- var loop, loops;
110
- var getA, setA, getB, setB, getC, setC, getD, setD, getX, setX, memView;
111
- var md5WA = function (message) {
112
- var m00, m01, m02, m03, m04, m05, m06, m07, m08, m09, m10, m11, m12, m13, m14, m15, aa, bb, cc, dd, m, k;
113
- var qwerty = new Date().getTime();
114
- var md5Used = 0;
115
- var a = 1732584193, b = -271733879, c = -1732584194, d = 271733878, i = 0, l = message.length * 8, len;
116
- len = bytesToWordsNewer(message, memView);
117
- memView[l >>> 5] |= 0x80 << l % 32;
118
- memView[(((l + 64) >>> 9) << 4) + 14] = l;
119
- len = (((l + 64) >>> 9) << 4) + 15;
120
- m = memView;
121
- // console.log("first loop took "+((new Date().getTime())-qwerty)+"ms");
122
- while (i < len) {
123
- if (len > i + bounder) {
124
- setA(a);
125
- setB(b);
126
- setC(c);
127
- setD(d);
128
- loops(biteSize);
129
- i = i + biteSize * 16;
130
- a = getA();
131
- b = getB();
132
- c = getC();
133
- d = getD();
134
- md5Used++;
135
- }
136
- else {
137
- aa = a;
138
- bb = b;
139
- cc = c;
140
- dd = d;
141
- m00 = m[i + 0] >>> 0;
142
- m01 = m[i + 1] >>> 0;
143
- m02 = m[i + 2] >>> 0;
144
- m03 = m[i + 3] >>> 0;
145
- m04 = m[i + 4] >>> 0;
146
- m05 = m[i + 5] >>> 0;
147
- m06 = m[i + 6] >>> 0;
148
- m07 = m[i + 7] >>> 0;
149
- m08 = m[i + 8] >>> 0;
150
- m09 = m[i + 9] >>> 0;
151
- m10 = m[i + 10] >>> 0;
152
- m11 = m[i + 11] >>> 0;
153
- m12 = m[i + 12] >>> 0;
154
- m13 = m[i + 13] >>> 0;
155
- m14 = m[i + 14] >>> 0;
156
- m15 = m[i + 15] >>> 0;
157
- a = ____(7, 25, a + ((b & c) | (~b & d)) + m00 - 680876936) + b;
158
- d = ____(12, 20, d + ((a & b) | (~a & c)) + m01 - 389564586) + a;
159
- c = ____(17, 15, c + ((d & a) | (~d & b)) + m02 + 606105819) + d;
160
- b = ____(22, 10, b + ((c & d) | (~c & a)) + m03 - 1044525330) + c;
161
- a = ____(7, 25, a + ((b & c) | (~b & d)) + m04 - 176418897) + b;
162
- d = ____(12, 20, d + ((a & b) | (~a & c)) + m05 + 1200080426) + a;
163
- c = ____(17, 15, c + ((d & a) | (~d & b)) + m06 - 1473231341) + d;
164
- b = ____(22, 10, b + ((c & d) | (~c & a)) + m07 - 45705983) + c;
165
- a = ____(7, 25, a + ((b & c) | (~b & d)) + m08 + 1770035416) + b;
166
- d = ____(12, 20, d + ((a & b) | (~a & c)) + m09 - 1958414417) + a;
167
- c = ____(17, 15, c + ((d & a) | (~d & b)) + m10 - 42063) + d;
168
- b = ____(22, 10, b + ((c & d) | (~c & a)) + m11 - 1990404162) + c;
169
- a = ____(7, 25, a + ((b & c) | (~b & d)) + m12 + 1804603682) + b;
170
- d = ____(12, 20, d + ((a & b) | (~a & c)) + m13 - 40341101) + a;
171
- c = ____(17, 15, c + ((d & a) | (~d & b)) + m14 - 1502002290) + d;
172
- b = ____(22, 10, b + ((c & d) | (~c & a)) + m15 + 1236535329) + c;
173
- a = ____(5, 27, a + ((b & d) | (c & ~d)) + m01 - 165796510) + b;
174
- d = ____(9, 23, d + ((a & c) | (b & ~c)) + m06 - 1069501632) + a;
175
- c = ____(14, 18, c + ((d & b) | (a & ~b)) + m11 + 643717713) + d;
176
- b = ____(20, 12, b + ((c & a) | (d & ~a)) + m00 - 373897302) + c;
177
- a = ____(5, 27, a + ((b & d) | (c & ~d)) + m05 - 701558691) + b;
178
- d = ____(9, 23, d + ((a & c) | (b & ~c)) + m10 + 38016083) + a;
179
- c = ____(14, 18, c + ((d & b) | (a & ~b)) + m15 - 660478335) + d;
180
- b = ____(20, 12, b + ((c & a) | (d & ~a)) + m04 - 405537848) + c;
181
- a = ____(5, 27, a + ((b & d) | (c & ~d)) + m09 + 568446438) + b;
182
- d = ____(9, 23, d + ((a & c) | (b & ~c)) + m14 - 1019803690) + a;
183
- c = ____(14, 18, c + ((d & b) | (a & ~b)) + m03 - 187363961) + d;
184
- b = ____(20, 12, b + ((c & a) | (d & ~a)) + m08 + 1163531501) + c;
185
- a = ____(5, 27, a + ((b & d) | (c & ~d)) + m13 - 1444681467) + b;
186
- d = ____(9, 23, d + ((a & c) | (b & ~c)) + m02 - 51403784) + a;
187
- c = ____(14, 18, c + ((d & b) | (a & ~b)) + m07 + 1735328473) + d;
188
- b = ____(20, 12, b + ((c & a) | (d & ~a)) + m12 - 1926607734) + c;
189
- a = ____(4, 28, a + (b ^ c ^ d) + m05 - 378558) + b;
190
- d = ____(11, 21, d + (a ^ b ^ c) + m08 - 2022574463) + a;
191
- c = ____(16, 16, c + (d ^ a ^ b) + m11 + 1839030562) + d;
192
- b = ____(23, 9, b + (c ^ d ^ a) + m14 - 35309556) + c;
193
- a = ____(4, 28, a + (b ^ c ^ d) + m01 - 1530992060) + b;
194
- d = ____(11, 21, d + (a ^ b ^ c) + m04 + 1272893353) + a;
195
- c = ____(16, 16, c + (d ^ a ^ b) + m07 - 155497632) + d;
196
- b = ____(23, 9, b + (c ^ d ^ a) + m10 - 1094730640) + c;
197
- a = ____(4, 28, a + (b ^ c ^ d) + m13 + 681279174) + b;
198
- d = ____(11, 21, d + (a ^ b ^ c) + m00 - 358537222) + a;
199
- c = ____(16, 16, c + (d ^ a ^ b) + m03 - 722521979) + d;
200
- b = ____(23, 9, b + (c ^ d ^ a) + m06 + 76029189) + c;
201
- a = ____(4, 28, a + (b ^ c ^ d) + m09 - 640364487) + b;
202
- d = ____(11, 21, d + (a ^ b ^ c) + m12 - 421815835) + a;
203
- c = ____(16, 16, c + (d ^ a ^ b) + m15 + 530742520) + d;
204
- b = ____(23, 9, b + (c ^ d ^ a) + m02 - 995338651) + c;
205
- a = ____(6, 26, a + (c ^ (b | ~d)) + m00 - 198630844) + b;
206
- d = ____(10, 22, d + (b ^ (a | ~c)) + m07 + 1126891415) + a;
207
- c = ____(15, 17, c + (a ^ (d | ~b)) + m14 - 1416354905) + d;
208
- b = ____(21, 11, b + (d ^ (c | ~a)) + m05 - 57434055) + c;
209
- a = ____(6, 26, a + (c ^ (b | ~d)) + m12 + 1700485571) + b;
210
- d = ____(10, 22, d + (b ^ (a | ~c)) + m03 - 1894986606) + a;
211
- c = ____(15, 17, c + (a ^ (d | ~b)) + m10 - 1051523) + d;
212
- b = ____(21, 11, b + (d ^ (c | ~a)) + m01 - 2054922799) + c;
213
- a = ____(6, 26, a + (c ^ (b | ~d)) + m08 + 1873313359) + b;
214
- d = ____(10, 22, d + (b ^ (a | ~c)) + m15 - 30611744) + a;
215
- c = ____(15, 17, c + (a ^ (d | ~b)) + m06 - 1560198380) + d;
216
- b = ____(21, 11, b + (d ^ (c | ~a)) + m13 + 1309151649) + c;
217
- a = ____(6, 26, a + (c ^ (b | ~d)) + m04 - 145523070) + b;
218
- d = ____(10, 22, d + (b ^ (a | ~c)) + m11 - 1120210379) + a;
219
- c = ____(15, 17, c + (a ^ (d | ~b)) + m02 + 718787259) + d;
220
- b = ____(21, 11, b + (d ^ (c | ~a)) + m09 - 343485551) + c;
221
- i = i + 16;
222
- a = (a + aa) >>> 0;
223
- b = (b + bb) >>> 0;
224
- c = (c + cc) >>> 0;
225
- d = (d + dd) >>> 0;
226
- }
227
- }
228
- // console.log("md5WA, elapsed="+((new Date().getTime())-qwerty)+(md5Used?", WebAssembly called "+md5Used+" times":", WebAssembly not called"));
229
- return crypt.endian([a, b, c, d]);
230
- function ____(s, t, n) {
231
- return (n << s) | (n >>> t);
232
- }
233
- // Convert a byte array to big-endian 32-bit words
234
- function bytesToWordsNewer(bytes, words) {
235
- var i = -1, l = Math.floor((bytes.length - 1) / 4), j = 0, b0, b1, b2, b3;
236
- while (l - 8 > i++) {
237
- j = i << 2;
238
- words[i] = bytes[j + 0] | (bytes[j + 1] << 8) | (bytes[j + 2] << 16) | (bytes[j + 3] << 24);
239
- }
240
- i--;
241
- while (l > i++) {
242
- j = i << 2;
243
- b0 = typeof bytes[j + 0] === 'undefined' ? 0 : bytes[j + 0];
244
- b1 = typeof bytes[j + 1] === 'undefined' ? 0 : bytes[j + 1];
245
- b2 = typeof bytes[j + 2] === 'undefined' ? 0 : bytes[j + 2];
246
- b3 = typeof bytes[j + 3] === 'undefined' ? 0 : bytes[j + 3];
247
- words[i] = b0 | (b1 << 8) | (b2 << 16) | (b3 << 24);
248
- }
249
- return l + 1;
250
- }
251
- };
252
- return function (message, exports, mView, options) {
253
- var digestbytes;
254
- loops = exports.loops;
255
- loop = exports.loop;
256
- getA = exports.getA;
257
- getB = exports.getB;
258
- getC = exports.getC;
259
- getD = exports.getD;
260
- getX = exports.getX;
261
- setA = exports.setA;
262
- setB = exports.setB;
263
- setC = exports.setC;
264
- setD = exports.setD;
265
- setX = exports.setX;
266
- memView = mView;
267
- digestbytes = crypt.wordsToBytes(md5WA(message));
268
- return options && options.asBytes ? digestbytes : crypt.bytesToHex(digestbytes);
269
- };
270
- }
271
- function makeMD5JS() {
272
- var md5JS = function (message, options) {
273
- var m00, m01, m02, m03, m04, m05, m06, m07, m08, m09, m10, m11, m12, m13, m14, m15, aa, bb, cc, dd, m;
274
- var qwerty = new Date().getTime();
275
- // console.log("md5 start");
276
- var a = 1732584193, b = -271733879, c = -1732584194, d = 271733878, l = message.length * 8;
277
- m = crypt.bytesToWords(message);
278
- // Swap endian
279
- for (var j = 0; j < m.length; j++) {
280
- m[j] =
281
- (((m[j] << 8) | (m[j] >>> 24)) & 0x00ff00ff) | (((m[j] << 24) | (m[j] >>> 8)) & 0xff00ff00);
282
- }
283
- // Padding
284
- m[l >>> 5] |= 0x80 << l % 32;
285
- m[(((l + 64) >>> 9) << 4) + 14] = l;
286
- for (var i = 0; i < m.length; i += 16) {
287
- aa = a;
288
- bb = b;
289
- cc = c;
290
- dd = d;
291
- m00 = m[i + 0] >>> 0;
292
- m01 = m[i + 1] >>> 0;
293
- m02 = m[i + 2] >>> 0;
294
- m03 = m[i + 3] >>> 0;
295
- m04 = m[i + 4] >>> 0;
296
- m05 = m[i + 5] >>> 0;
297
- m06 = m[i + 6] >>> 0;
298
- m07 = m[i + 7] >>> 0;
299
- m08 = m[i + 8] >>> 0;
300
- m09 = m[i + 9] >>> 0;
301
- m10 = m[i + 10] >>> 0;
302
- m11 = m[i + 11] >>> 0;
303
- m12 = m[i + 12] >>> 0;
304
- m13 = m[i + 13] >>> 0;
305
- m14 = m[i + 14] >>> 0;
306
- m15 = m[i + 15] >>> 0;
307
- a = ____(7, 25, a + ((b & c) | (~b & d)) + m00 - 680876936) + b;
308
- d = ____(12, 20, d + ((a & b) | (~a & c)) + m01 - 389564586) + a;
309
- c = ____(17, 15, c + ((d & a) | (~d & b)) + m02 + 606105819) + d;
310
- b = ____(22, 10, b + ((c & d) | (~c & a)) + m03 - 1044525330) + c;
311
- a = ____(7, 25, a + ((b & c) | (~b & d)) + m04 - 176418897) + b;
312
- d = ____(12, 20, d + ((a & b) | (~a & c)) + m05 + 1200080426) + a;
313
- c = ____(17, 15, c + ((d & a) | (~d & b)) + m06 - 1473231341) + d;
314
- b = ____(22, 10, b + ((c & d) | (~c & a)) + m07 - 45705983) + c;
315
- a = ____(7, 25, a + ((b & c) | (~b & d)) + m08 + 1770035416) + b;
316
- d = ____(12, 20, d + ((a & b) | (~a & c)) + m09 - 1958414417) + a;
317
- c = ____(17, 15, c + ((d & a) | (~d & b)) + m10 - 42063) + d;
318
- b = ____(22, 10, b + ((c & d) | (~c & a)) + m11 - 1990404162) + c;
319
- a = ____(7, 25, a + ((b & c) | (~b & d)) + m12 + 1804603682) + b;
320
- d = ____(12, 20, d + ((a & b) | (~a & c)) + m13 - 40341101) + a;
321
- c = ____(17, 15, c + ((d & a) | (~d & b)) + m14 - 1502002290) + d;
322
- b = ____(22, 10, b + ((c & d) | (~c & a)) + m15 + 1236535329) + c;
323
- a = ____(5, 27, a + ((b & d) | (c & ~d)) + m01 - 165796510) + b;
324
- d = ____(9, 23, d + ((a & c) | (b & ~c)) + m06 - 1069501632) + a;
325
- c = ____(14, 18, c + ((d & b) | (a & ~b)) + m11 + 643717713) + d;
326
- b = ____(20, 12, b + ((c & a) | (d & ~a)) + m00 - 373897302) + c;
327
- a = ____(5, 27, a + ((b & d) | (c & ~d)) + m05 - 701558691) + b;
328
- d = ____(9, 23, d + ((a & c) | (b & ~c)) + m10 + 38016083) + a;
329
- c = ____(14, 18, c + ((d & b) | (a & ~b)) + m15 - 660478335) + d;
330
- b = ____(20, 12, b + ((c & a) | (d & ~a)) + m04 - 405537848) + c;
331
- a = ____(5, 27, a + ((b & d) | (c & ~d)) + m09 + 568446438) + b;
332
- d = ____(9, 23, d + ((a & c) | (b & ~c)) + m14 - 1019803690) + a;
333
- c = ____(14, 18, c + ((d & b) | (a & ~b)) + m03 - 187363961) + d;
334
- b = ____(20, 12, b + ((c & a) | (d & ~a)) + m08 + 1163531501) + c;
335
- a = ____(5, 27, a + ((b & d) | (c & ~d)) + m13 - 1444681467) + b;
336
- d = ____(9, 23, d + ((a & c) | (b & ~c)) + m02 - 51403784) + a;
337
- c = ____(14, 18, c + ((d & b) | (a & ~b)) + m07 + 1735328473) + d;
338
- b = ____(20, 12, b + ((c & a) | (d & ~a)) + m12 - 1926607734) + c;
339
- a = ____(4, 28, a + (b ^ c ^ d) + m05 - 378558) + b;
340
- d = ____(11, 21, d + (a ^ b ^ c) + m08 - 2022574463) + a;
341
- c = ____(16, 16, c + (d ^ a ^ b) + m11 + 1839030562) + d;
342
- b = ____(23, 9, b + (c ^ d ^ a) + m14 - 35309556) + c;
343
- a = ____(4, 28, a + (b ^ c ^ d) + m01 - 1530992060) + b;
344
- d = ____(11, 21, d + (a ^ b ^ c) + m04 + 1272893353) + a;
345
- c = ____(16, 16, c + (d ^ a ^ b) + m07 - 155497632) + d;
346
- b = ____(23, 9, b + (c ^ d ^ a) + m10 - 1094730640) + c;
347
- a = ____(4, 28, a + (b ^ c ^ d) + m13 + 681279174) + b;
348
- d = ____(11, 21, d + (a ^ b ^ c) + m00 - 358537222) + a;
349
- c = ____(16, 16, c + (d ^ a ^ b) + m03 - 722521979) + d;
350
- b = ____(23, 9, b + (c ^ d ^ a) + m06 + 76029189) + c;
351
- a = ____(4, 28, a + (b ^ c ^ d) + m09 - 640364487) + b;
352
- d = ____(11, 21, d + (a ^ b ^ c) + m12 - 421815835) + a;
353
- c = ____(16, 16, c + (d ^ a ^ b) + m15 + 530742520) + d;
354
- b = ____(23, 9, b + (c ^ d ^ a) + m02 - 995338651) + c;
355
- a = ____(6, 26, a + (c ^ (b | ~d)) + m00 - 198630844) + b;
356
- d = ____(10, 22, d + (b ^ (a | ~c)) + m07 + 1126891415) + a;
357
- c = ____(15, 17, c + (a ^ (d | ~b)) + m14 - 1416354905) + d;
358
- b = ____(21, 11, b + (d ^ (c | ~a)) + m05 - 57434055) + c;
359
- a = ____(6, 26, a + (c ^ (b | ~d)) + m12 + 1700485571) + b;
360
- d = ____(10, 22, d + (b ^ (a | ~c)) + m03 - 1894986606) + a;
361
- c = ____(15, 17, c + (a ^ (d | ~b)) + m10 - 1051523) + d;
362
- b = ____(21, 11, b + (d ^ (c | ~a)) + m01 - 2054922799) + c;
363
- a = ____(6, 26, a + (c ^ (b | ~d)) + m08 + 1873313359) + b;
364
- d = ____(10, 22, d + (b ^ (a | ~c)) + m15 - 30611744) + a;
365
- c = ____(15, 17, c + (a ^ (d | ~b)) + m06 - 1560198380) + d;
366
- b = ____(21, 11, b + (d ^ (c | ~a)) + m13 + 1309151649) + c;
367
- a = ____(6, 26, a + (c ^ (b | ~d)) + m04 - 145523070) + b;
368
- d = ____(10, 22, d + (b ^ (a | ~c)) + m11 - 1120210379) + a;
369
- c = ____(15, 17, c + (a ^ (d | ~b)) + m02 + 718787259) + d;
370
- b = ____(21, 11, b + (d ^ (c | ~a)) + m09 - 343485551) + c;
371
- a = (a + aa) >>> 0;
372
- b = (b + bb) >>> 0;
373
- c = (c + cc) >>> 0;
374
- d = (d + dd) >>> 0;
375
- }
376
- // console.log("md5JS, elapsed="+((new Date().getTime())-qwerty));
377
- return crypt.endian([a, b, c, d]);
378
- function ____(s, t, n) {
379
- return (n << s) | (n >>> t);
380
- }
381
- };
382
- return function (message, options) {
383
- var digestbytes = crypt.wordsToBytes(md5JS(message, options)), result = options && options.asBytes ? digestbytes : crypt.bytesToHex(digestbytes);
384
- return result;
385
- };
386
- }
387
- function str2AB(str) {
388
- var l, buff, buffView, i = -1;
389
- l = str.length - 1;
390
- buff = new ArrayBuffer(str.length);
391
- buffView = new Uint8Array(buff);
392
- while (l > i++) {
393
- buffView[i] = str.charCodeAt(i);
394
- }
395
- return buffView;
396
- }
397
- function nodeATOB(str) {
398
- return Buffer.from(str, 'base64').toString('binary');
399
- }
400
- function identity(x) {
401
- return x;
402
- }
403
- function makeCrypt() {
404
- var base64map = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
405
- return {
406
- rotl: function (n, b) {
407
- return (n << b) | (n >>> (32 - b));
408
- },
409
- endian: function (n) {
410
- if (n.constructor == Number) {
411
- return (crypt.rotl(n, 8) & 0x00ff00ff) | (crypt.rotl(n, 24) & 0xff00ff00);
412
- }
413
- for (var i = 0; i < n.length; i++)
414
- n[i] = crypt.endian(n[i]);
415
- return n;
416
- },
417
- bytesToWords: function (bytes) {
418
- for (var words = [], i = 0, b = 0; i < bytes.length; i++, b += 8)
419
- words[b >>> 5] |= bytes[i] << (24 - (b % 32));
420
- return words;
421
- },
422
- wordsToBytes: function (words) {
423
- for (var bytes = [], b = 0; b < words.length * 32; b += 8)
424
- bytes.push((words[b >>> 5] >>> (24 - (b % 32))) & 0xff);
425
- return bytes;
426
- },
427
- bytesToHex: function (bytes) {
428
- for (var hex = [], i = 0; i < bytes.length; i++) {
429
- hex.push((bytes[i] >>> 4).toString(16));
430
- hex.push((bytes[i] & 0xf).toString(16));
431
- }
432
- return hex.join('');
433
- }
434
- };
435
- }
@@ -1,47 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.CRC32Hash = void 0;
7
- // CRC32
8
- const hash_1 = require("./hash");
9
- const crc32_1 = __importDefault(require("./algorithms/crc32"));
10
- const digest_utils_1 = require("./utils/digest-utils");
11
- /**
12
- * Calculates CRC32 Cryptographic Hash
13
- */
14
- class CRC32Hash extends hash_1.Hash {
15
- constructor(options = {}) {
16
- super();
17
- this.name = 'crc32';
18
- this.options = { crypto: {}, ...options };
19
- this._hash = new crc32_1.default();
20
- this.hashBatches = this.hashBatches.bind(this);
21
- }
22
- /**
23
- * Atomic hash calculation
24
- * @returns base64 encoded hash
25
- */
26
- async hash(input) {
27
- return this.hashSync(input);
28
- }
29
- hashSync(input) {
30
- this._hash.update(input);
31
- const hashValue = this._hash.finalize();
32
- const hex = (0, digest_utils_1.toHex)(hashValue);
33
- const hash = (0, digest_utils_1.hexToBase64)(hex);
34
- return hash;
35
- }
36
- async *hashBatches(asyncIterator) {
37
- for await (const chunk of asyncIterator) {
38
- this._hash.update(chunk);
39
- yield chunk;
40
- }
41
- const hashValue = this._hash.finalize();
42
- const hex = (0, digest_utils_1.toHex)(hashValue);
43
- const hash = (0, digest_utils_1.hexToBase64)(hex);
44
- this.options.crypto?.onEnd?.({ hash });
45
- }
46
- }
47
- exports.CRC32Hash = CRC32Hash;
@@ -1,51 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.CRC32CHash = void 0;
7
- // CRC32c
8
- const hash_1 = require("./hash");
9
- const crc32c_1 = __importDefault(require("./algorithms/crc32c"));
10
- const digest_utils_1 = require("./utils/digest-utils");
11
- /**
12
- * A transform that calculates CRC32c Hash
13
- */
14
- class CRC32CHash extends hash_1.Hash {
15
- /**
16
- * Atomic hash calculation
17
- * @returns base64 encoded hash
18
- */
19
- constructor(options = {}) {
20
- super();
21
- this.name = 'crc32c';
22
- this.options = { crypto: {}, ...options };
23
- this._hash = new crc32c_1.default(options);
24
- }
25
- /**
26
- * Atomic hash calculation
27
- * @returns base64 encoded hash
28
- */
29
- async hash(input) {
30
- return this.hashSync(input);
31
- }
32
- hashSync(input) {
33
- this._hash.update(input);
34
- const hashValue = this._hash.finalize();
35
- const hex = (0, digest_utils_1.toHex)(hashValue);
36
- const hash = (0, digest_utils_1.hexToBase64)(hex);
37
- return hash;
38
- }
39
- // runInBatches inherited
40
- async *hashBatches(asyncIterator) {
41
- for await (const chunk of asyncIterator) {
42
- this._hash.update(chunk);
43
- yield chunk;
44
- }
45
- const hashValue = this._hash.finalize();
46
- const hex = (0, digest_utils_1.toHex)(hashValue);
47
- const hash = (0, digest_utils_1.hexToBase64)(hex);
48
- this.options.crypto?.onEnd?.({ hash });
49
- }
50
- }
51
- exports.CRC32CHash = CRC32CHash;
@@ -1,61 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CryptoHash = void 0;
4
- const hash_1 = require("./hash");
5
- let CryptoJS;
6
- /**
7
- * A transform that calculates Cryptographic Hash using Crypto JS library
8
- * @deprecated Warning, experimental class
9
- */
10
- class CryptoHash extends hash_1.Hash {
11
- constructor(options) {
12
- super();
13
- this.options = options;
14
- this._algorithm = this.options?.crypto?.algorithm;
15
- if (!this._algorithm) {
16
- throw new Error(this.name);
17
- }
18
- this.name = this._algorithm.toLowerCase();
19
- }
20
- async preload() {
21
- if (!CryptoJS) {
22
- CryptoJS = this.options?.modules?.CryptoJS;
23
- if (!CryptoJS) {
24
- throw new Error(this.name);
25
- }
26
- }
27
- if (!this._hash) {
28
- const algo = CryptoJS.algo[this._algorithm];
29
- this._hash = algo.create();
30
- }
31
- if (!this._hash) {
32
- throw new Error(this.name);
33
- }
34
- }
35
- /**
36
- * Atomic hash calculation
37
- * @returns base64 encoded hash
38
- */
39
- async hash(input) {
40
- await this.preload();
41
- // arrayBuffer is accepted, even though types and docs say no
42
- // https://stackoverflow.com/questions/25567468/how-to-decrypt-an-arraybuffer
43
- // @ts-expect-error
44
- const typedWordArray = CryptoJS.lib.WordArray.create(input);
45
- return this._hash.update(typedWordArray).finalize().toString(CryptoJS.enc.Base64);
46
- }
47
- async *hashBatches(asyncIterator) {
48
- await this.preload();
49
- for await (const chunk of asyncIterator) {
50
- // arrayBuffer is accepted, even though types and docs say no
51
- // https://stackoverflow.com/questions/25567468/how-to-decrypt-an-arraybuffer
52
- // @ts-expect-error
53
- const typedWordArray = CryptoJS.lib.WordArray.create(chunk);
54
- this._hash.update(typedWordArray);
55
- yield chunk;
56
- }
57
- const hash = this._hash.finalize().toString(CryptoJS.enc.Base64);
58
- this.options?.crypto?.onEnd?.({ hash });
59
- }
60
- }
61
- exports.CryptoHash = CryptoHash;
package/dist/lib/hash.js DELETED
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Hash = void 0;
4
- // Hash
5
- const loader_utils_1 = require("@loaders.gl/loader-utils");
6
- /** Abstract hash base class */
7
- class Hash {
8
- constructor(options = {}) {
9
- this.hashBatches = this.hashBatches.bind(this);
10
- }
11
- async preload() {
12
- return;
13
- }
14
- async *hashBatches(asyncIterator) {
15
- const arrayBuffers = [];
16
- for await (const arrayBuffer of asyncIterator) {
17
- arrayBuffers.push(arrayBuffer);
18
- yield arrayBuffer;
19
- }
20
- const output = await this.concatenate(arrayBuffers);
21
- const hash = await this.hash(output);
22
- this.options.crypto?.onEnd?.({ hash });
23
- }
24
- // HELPERS
25
- async concatenate(asyncIterator) {
26
- return await (0, loader_utils_1.concatenateArrayBuffersAsync)(asyncIterator);
27
- }
28
- }
29
- exports.Hash = Hash;
@@ -1,32 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.MD5Hash = void 0;
7
- // Fork of https://github.com/briantbutton/md5-wasm under MIT license
8
- const hash_1 = require("./hash");
9
- const md5_wasm_1 = __importDefault(require("./algorithms/md5-wasm"));
10
- const digest_utils_1 = require("./utils/digest-utils");
11
- /**
12
- * A transform that calculates MD5 hashes, passing data through
13
- */
14
- class MD5Hash extends hash_1.Hash {
15
- constructor(options = {}) {
16
- super();
17
- this.name = 'md5';
18
- this.options = options;
19
- }
20
- /**
21
- * Atomic hash calculation
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
- }
31
- }
32
- exports.MD5Hash = MD5Hash;
@@ -1,42 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NodeHash = void 0;
4
- // This dependency is too big, application must provide it
5
- const hash_1 = require("./hash");
6
- const crypto_1 = require("crypto"); // Node.js builtin
7
- /**
8
- * Calculates Cryptographic Hash using Node.js crypto library
9
- * @deprecated Warning, experimental class
10
- */
11
- class NodeHash extends hash_1.Hash {
12
- constructor(options) {
13
- super();
14
- this.name = 'crypto-node';
15
- this.options = options;
16
- if (!this.options?.crypto?.algorithm) {
17
- throw new Error(this.name);
18
- }
19
- }
20
- /**
21
- * Atomic hash calculation
22
- * @returns base64 encoded hash
23
- */
24
- async hash(input) {
25
- await this.preload();
26
- const hash = (0, crypto_1.createHash)(this.options?.crypto?.algorithm?.toLowerCase());
27
- const inputArray = new Uint8Array(input);
28
- return hash.update(inputArray).digest('base64');
29
- }
30
- async *hashBatches(asyncIterator) {
31
- await this.preload();
32
- const hash = (0, crypto_1.createHash)(this.options?.crypto?.algorithm?.toLowerCase());
33
- for await (const chunk of asyncIterator) {
34
- // https://stackoverflow.com/questions/25567468/how-to-decrypt-an-arraybuffer
35
- const inputArray = new Uint8Array(chunk);
36
- hash.update(inputArray);
37
- yield chunk;
38
- }
39
- this.options?.crypto?.onEnd?.({ hash: hash.digest('base64') });
40
- }
41
- }
42
- exports.NodeHash = NodeHash;
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SHA256Hash = void 0;
4
- //
5
- const crypto_hash_1 = require("./crypto-hash");
6
- /**
7
- * A transform that calculates Cryptographic Hash
8
- */
9
- class SHA256Hash extends crypto_hash_1.CryptoHash {
10
- constructor(options) {
11
- super({ ...options, crypto: { ...options.crypto, algorithm: 'SHA256' } });
12
- }
13
- }
14
- exports.SHA256Hash = SHA256Hash;
@@ -1,67 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toBase64 = void 0;
4
- /**
5
- * `btoa()` polyfill as defined by the HTML and Infra specs, which mostly just references
6
- * RFC 4648.
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
- }
17
- }
18
- let out = '';
19
- for (let i = 0; i < string.length; i += 3) {
20
- /** @type {Array[4]} */
21
- const groupsOfSix = [undefined, undefined, undefined, undefined];
22
- groupsOfSix[0] = string.charCodeAt(i) >> 2;
23
- groupsOfSix[1] = (string.charCodeAt(i) & 0x03) << 4;
24
- if (string.length > i + 1) {
25
- groupsOfSix[1] |= string.charCodeAt(i + 1) >> 4;
26
- groupsOfSix[2] = (string.charCodeAt(i + 1) & 0x0f) << 2;
27
- }
28
- if (string.length > i + 2) {
29
- // @ts-expect-error
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
- }
41
- }
42
- return out;
43
- }
44
- exports.toBase64 = toBase64;
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));
58
- }
59
- if (idx === 62) {
60
- return '+';
61
- }
62
- if (idx === 63) {
63
- return '/';
64
- }
65
- // Throw INVALID_CHARACTER_ERR exception here -- won't be hit in the teststring.
66
- return undefined;
67
- }
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hexToBase64 = exports.toHex = void 0;
4
- const base64_utils_1 = require("./base64-utils");
5
- /**
6
- *
7
- */
8
- function toHex(cipher) {
9
- const hexString = cipher.toString(16);
10
- return hexString === '0' ? `0${hexString}` : hexString;
11
- }
12
- exports.toHex = toHex;
13
- /**
14
- * @see https://stackoverflow.com/questions/23190056/hex-to-base64-converter-for-javascript
15
- */
16
- function hexToBase64(hexstring) {
17
- // Add leading zero to keep even count of digits
18
- // eg. f85d741 => 0f85d741
19
- if (hexstring.length % 2 !== 0) {
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) || '';
26
- }
27
- exports.hexToBase64 = hexToBase64;
package/dist/types.js DELETED
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CRC32CHash = exports.CRC32Hash = void 0;
4
- const worker_utils_1 = require("@loaders.gl/worker-utils");
5
- const crc32_hash_1 = require("../lib/crc32-hash");
6
- Object.defineProperty(exports, "CRC32Hash", { enumerable: true, get: function () { return crc32_hash_1.CRC32Hash; } });
7
- const crc32c_hash_1 = require("../lib/crc32c-hash");
8
- Object.defineProperty(exports, "CRC32CHash", { enumerable: true, get: function () { return crc32c_hash_1.CRC32CHash; } });
9
- const md5_hash_1 = require("../lib/md5-hash");
10
- (0, worker_utils_1.createWorker)(async (data, options = {}) => {
11
- // @ts-ignore
12
- const { operation } = options;
13
- switch (operation) {
14
- case 'crc32':
15
- return await new crc32_hash_1.CRC32Hash(options).hash(data);
16
- case 'crc32c':
17
- return await new crc32c_hash_1.CRC32CHash(options).hash(data);
18
- case 'md5':
19
- return await new md5_hash_1.MD5Hash(options).hash(data);
20
- default:
21
- throw new Error(`invalid option: ${operation}`);
22
- }
23
- });