@aws-sdk/crc64-nvme 3.972.10 → 3.972.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-cjs/index.js CHANGED
@@ -1,101 +1,8 @@
1
1
  'use strict';
2
2
 
3
- const generateCRC64NVMETable = () => {
4
- const sliceLength = 8;
5
- const tables = new Array(sliceLength);
6
- for (let slice = 0; slice < sliceLength; slice++) {
7
- const table = new Array(512);
8
- for (let i = 0; i < 256; i++) {
9
- let crc = BigInt(i);
10
- for (let j = 0; j < 8 * (slice + 1); j++) {
11
- if (crc & 1n) {
12
- crc = (crc >> 1n) ^ 0x9a6c9329ac4bc9b5n;
13
- }
14
- else {
15
- crc = crc >> 1n;
16
- }
17
- }
18
- table[i * 2] = Number((crc >> 32n) & 0xffffffffn);
19
- table[i * 2 + 1] = Number(crc & 0xffffffffn);
20
- }
21
- tables[slice] = new Uint32Array(table);
22
- }
23
- return tables;
24
- };
25
- let CRC64_NVME_REVERSED_TABLE;
26
- let t0, t1, t2, t3;
27
- let t4, t5, t6, t7;
28
- const ensureTablesInitialized = () => {
29
- if (!CRC64_NVME_REVERSED_TABLE) {
30
- CRC64_NVME_REVERSED_TABLE = generateCRC64NVMETable();
31
- [t0, t1, t2, t3, t4, t5, t6, t7] = CRC64_NVME_REVERSED_TABLE;
32
- }
33
- };
34
- class Crc64Nvme {
35
- c1 = 0;
36
- c2 = 0;
37
- constructor() {
38
- ensureTablesInitialized();
39
- this.reset();
40
- }
41
- update(data) {
42
- const len = data.length;
43
- let i = 0;
44
- let crc1 = this.c1;
45
- let crc2 = this.c2;
46
- while (i + 8 <= len) {
47
- const idx0 = ((crc2 ^ data[i++]) & 255) << 1;
48
- const idx1 = (((crc2 >>> 8) ^ data[i++]) & 255) << 1;
49
- const idx2 = (((crc2 >>> 16) ^ data[i++]) & 255) << 1;
50
- const idx3 = (((crc2 >>> 24) ^ data[i++]) & 255) << 1;
51
- const idx4 = ((crc1 ^ data[i++]) & 255) << 1;
52
- const idx5 = (((crc1 >>> 8) ^ data[i++]) & 255) << 1;
53
- const idx6 = (((crc1 >>> 16) ^ data[i++]) & 255) << 1;
54
- const idx7 = (((crc1 >>> 24) ^ data[i++]) & 255) << 1;
55
- crc1 = t7[idx0] ^ t6[idx1] ^ t5[idx2] ^ t4[idx3] ^ t3[idx4] ^ t2[idx5] ^ t1[idx6] ^ t0[idx7];
56
- crc2 =
57
- t7[idx0 + 1] ^
58
- t6[idx1 + 1] ^
59
- t5[idx2 + 1] ^
60
- t4[idx3 + 1] ^
61
- t3[idx4 + 1] ^
62
- t2[idx5 + 1] ^
63
- t1[idx6 + 1] ^
64
- t0[idx7 + 1];
65
- }
66
- while (i < len) {
67
- const idx = ((crc2 ^ data[i]) & 255) << 1;
68
- crc2 = ((crc2 >>> 8) | ((crc1 & 255) << 24)) >>> 0;
69
- crc1 = (crc1 >>> 8) ^ t0[idx];
70
- crc2 ^= t0[idx + 1];
71
- i++;
72
- }
73
- this.c1 = crc1;
74
- this.c2 = crc2;
75
- }
76
- async digest() {
77
- const c1 = this.c1 ^ 4294967295;
78
- const c2 = this.c2 ^ 4294967295;
79
- return new Uint8Array([
80
- c1 >>> 24,
81
- (c1 >>> 16) & 255,
82
- (c1 >>> 8) & 255,
83
- c1 & 255,
84
- c2 >>> 24,
85
- (c2 >>> 16) & 255,
86
- (c2 >>> 8) & 255,
87
- c2 & 255,
88
- ]);
89
- }
90
- reset() {
91
- this.c1 = 4294967295;
92
- this.c2 = 4294967295;
93
- }
94
- }
3
+ var checksums = require('@aws-sdk/checksums');
95
4
 
96
- const crc64NvmeCrtContainer = {
97
- CrtCrc64Nvme: null,
98
- };
99
5
 
100
- exports.Crc64Nvme = Crc64Nvme;
101
- exports.crc64NvmeCrtContainer = crc64NvmeCrtContainer;
6
+
7
+ exports.Crc64Nvme = checksums.Crc64Nvme;
8
+ exports.crc64NvmeCrtContainer = checksums.crc64NvmeCrtContainer;
package/dist-es/index.js CHANGED
@@ -1,2 +1 @@
1
- export * from "./Crc64Nvme";
2
- export * from "./crc64-nvme-crt-container";
1
+ export { Crc64Nvme, crc64NvmeCrtContainer } from "@aws-sdk/checksums";
@@ -1,2 +1 @@
1
- export * from "./Crc64Nvme";
2
- export * from "./crc64-nvme-crt-container";
1
+ export { Crc64Nvme, crc64NvmeCrtContainer } from "@aws-sdk/checksums";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/crc64-nvme",
3
- "version": "3.972.10",
3
+ "version": "3.972.12",
4
4
  "description": "A pure JS implementation of CRC64-NVME checksum",
5
5
  "main": "./dist-cjs/index.js",
6
6
  "module": "./dist-es/index.js",
@@ -11,26 +11,20 @@
11
11
  "build:es": "tsc -p tsconfig.es.json",
12
12
  "build:include:deps": "yarn g:turbo run build -F=\"$npm_package_name\"",
13
13
  "build:types": "tsc -p tsconfig.types.json",
14
- "build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
15
- "clean": "premove dist-cjs dist-es dist-types tsconfig.cjs.tsbuildinfo tsconfig.es.tsbuildinfo tsconfig.types.tsbuildinfo",
16
- "extract:docs": "api-extractor run --local",
17
- "test": "yarn g:vitest run",
18
- "test:watch": "yarn g:vitest watch"
14
+ "clean": "premove dist-cjs dist-es dist-types tsconfig.cjs.tsbuildinfo tsconfig.es.tsbuildinfo tsconfig.types.tsbuildinfo"
19
15
  },
20
- "sideEffects": true,
16
+ "sideEffects": false,
21
17
  "author": {
22
18
  "name": "AWS SDK for JavaScript Team",
23
- "url": "https://aws.amazon.com/javascript/"
19
+ "url": "https://aws.amazon.com/sdk-for-javascript/"
24
20
  },
25
21
  "license": "Apache-2.0",
26
22
  "dependencies": {
27
- "@smithy/types": "^4.14.3",
23
+ "@aws-sdk/checksums": "^3.1000.2",
28
24
  "tslib": "^2.6.2"
29
25
  },
30
26
  "devDependencies": {
31
- "@tsconfig/recommended": "1.0.1",
32
27
  "concurrently": "7.0.0",
33
- "downlevel-dts": "0.10.1",
34
28
  "premove": "4.0.0",
35
29
  "typescript": "~5.8.3"
36
30
  },
@@ -1,92 +0,0 @@
1
- const generateCRC64NVMETable = () => {
2
- const sliceLength = 8;
3
- const tables = new Array(sliceLength);
4
- for (let slice = 0; slice < sliceLength; slice++) {
5
- const table = new Array(512);
6
- for (let i = 0; i < 256; i++) {
7
- let crc = BigInt(i);
8
- for (let j = 0; j < 8 * (slice + 1); j++) {
9
- if (crc & 1n) {
10
- crc = (crc >> 1n) ^ 0x9a6c9329ac4bc9b5n;
11
- }
12
- else {
13
- crc = crc >> 1n;
14
- }
15
- }
16
- table[i * 2] = Number((crc >> 32n) & 0xffffffffn);
17
- table[i * 2 + 1] = Number(crc & 0xffffffffn);
18
- }
19
- tables[slice] = new Uint32Array(table);
20
- }
21
- return tables;
22
- };
23
- let CRC64_NVME_REVERSED_TABLE;
24
- let t0, t1, t2, t3;
25
- let t4, t5, t6, t7;
26
- const ensureTablesInitialized = () => {
27
- if (!CRC64_NVME_REVERSED_TABLE) {
28
- CRC64_NVME_REVERSED_TABLE = generateCRC64NVMETable();
29
- [t0, t1, t2, t3, t4, t5, t6, t7] = CRC64_NVME_REVERSED_TABLE;
30
- }
31
- };
32
- export class Crc64Nvme {
33
- c1 = 0;
34
- c2 = 0;
35
- constructor() {
36
- ensureTablesInitialized();
37
- this.reset();
38
- }
39
- update(data) {
40
- const len = data.length;
41
- let i = 0;
42
- let crc1 = this.c1;
43
- let crc2 = this.c2;
44
- while (i + 8 <= len) {
45
- const idx0 = ((crc2 ^ data[i++]) & 255) << 1;
46
- const idx1 = (((crc2 >>> 8) ^ data[i++]) & 255) << 1;
47
- const idx2 = (((crc2 >>> 16) ^ data[i++]) & 255) << 1;
48
- const idx3 = (((crc2 >>> 24) ^ data[i++]) & 255) << 1;
49
- const idx4 = ((crc1 ^ data[i++]) & 255) << 1;
50
- const idx5 = (((crc1 >>> 8) ^ data[i++]) & 255) << 1;
51
- const idx6 = (((crc1 >>> 16) ^ data[i++]) & 255) << 1;
52
- const idx7 = (((crc1 >>> 24) ^ data[i++]) & 255) << 1;
53
- crc1 = t7[idx0] ^ t6[idx1] ^ t5[idx2] ^ t4[idx3] ^ t3[idx4] ^ t2[idx5] ^ t1[idx6] ^ t0[idx7];
54
- crc2 =
55
- t7[idx0 + 1] ^
56
- t6[idx1 + 1] ^
57
- t5[idx2 + 1] ^
58
- t4[idx3 + 1] ^
59
- t3[idx4 + 1] ^
60
- t2[idx5 + 1] ^
61
- t1[idx6 + 1] ^
62
- t0[idx7 + 1];
63
- }
64
- while (i < len) {
65
- const idx = ((crc2 ^ data[i]) & 255) << 1;
66
- crc2 = ((crc2 >>> 8) | ((crc1 & 255) << 24)) >>> 0;
67
- crc1 = (crc1 >>> 8) ^ t0[idx];
68
- crc2 ^= t0[idx + 1];
69
- i++;
70
- }
71
- this.c1 = crc1;
72
- this.c2 = crc2;
73
- }
74
- async digest() {
75
- const c1 = this.c1 ^ 4294967295;
76
- const c2 = this.c2 ^ 4294967295;
77
- return new Uint8Array([
78
- c1 >>> 24,
79
- (c1 >>> 16) & 255,
80
- (c1 >>> 8) & 255,
81
- c1 & 255,
82
- c2 >>> 24,
83
- (c2 >>> 16) & 255,
84
- (c2 >>> 8) & 255,
85
- c2 & 255,
86
- ]);
87
- }
88
- reset() {
89
- this.c1 = 4294967295;
90
- this.c2 = 4294967295;
91
- }
92
- }
@@ -1,3 +0,0 @@
1
- export const crc64NvmeCrtContainer = {
2
- CrtCrc64Nvme: null,
3
- };
@@ -1,24 +0,0 @@
1
- import type { Checksum } from "@smithy/types";
2
- /**
3
- * Implements CRC-64/NVME checksum algorithm.
4
- *
5
- * This class provides CRC-64 checksum calculation using the NVMe polynomial (0x9a6c9329ac4bc9b5).
6
- * It uses an 8-slice lookup table for efficient computation.
7
- *
8
- * @example
9
- * ```typescript
10
- * const checksum = new Crc64Nvme();
11
- * checksum.update(new Uint8Array([1, 2, 3]));
12
- * const result = await checksum.digest();
13
- * ```
14
- *
15
- * @public
16
- */
17
- export declare class Crc64Nvme implements Checksum {
18
- private c1;
19
- private c2;
20
- constructor();
21
- update(data: Uint8Array): void;
22
- digest(): Promise<Uint8Array>;
23
- reset(): void;
24
- }
@@ -1,13 +0,0 @@
1
- import type { ChecksumConstructor } from "@smithy/types";
2
- /**
3
- * @internal
4
- *
5
- * \@aws-sdk/crc64-nvme-crt will install the constructor in this
6
- * container if it is installed.
7
- *
8
- * This avoids a runtime-require being interpreted statically by bundlers.
9
- *
10
- */
11
- export declare const crc64NvmeCrtContainer: {
12
- CrtCrc64Nvme: null | ChecksumConstructor;
13
- };
@@ -1,9 +0,0 @@
1
- import { Checksum } from "@smithy/types";
2
- export declare class Crc64Nvme implements Checksum {
3
- private c1;
4
- private c2;
5
- constructor();
6
- update(data: Uint8Array): void;
7
- digest(): Promise<Uint8Array>;
8
- reset(): void;
9
- }
@@ -1,4 +0,0 @@
1
- import { ChecksumConstructor } from "@smithy/types";
2
- export declare const crc64NvmeCrtContainer: {
3
- CrtCrc64Nvme: null | ChecksumConstructor;
4
- };
@@ -1,2 +0,0 @@
1
- export * from "./Crc64Nvme";
2
- export * from "./crc64-nvme-crt-container";