@aws-sdk/checksums 3.1000.24 → 3.1000.26

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.
Files changed (2) hide show
  1. package/README.md +80 -0
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -4,3 +4,83 @@
4
4
  [![NPM downloads](https://img.shields.io/npm/dm/@aws-sdk/checksums.svg)](https://www.npmjs.com/package/@aws-sdk/checksums)
5
5
 
6
6
  Checksum algorithms and flexible checksums middleware for the AWS SDK.
7
+
8
+ ## Standardized API
9
+
10
+ The following checksum API symbols are available.
11
+
12
+ ```ts
13
+ import { Sha1, Sha256 } from "@aws-sdk/checksums/sha";
14
+ import { Md5 } from "@aws-sdk/checksums/md5";
15
+ import { Crc32, Crc32c, Crc64Nvme } from "@aws-sdk/checksums/crc";
16
+ ```
17
+
18
+ Each follows an identical interface, the Smithy Checksum interface:
19
+
20
+ ```ts
21
+ interface Checksum {
22
+ update(chunk: Uint8Array): void;
23
+ digest(): Promise<Uint8Array>;
24
+ reset();
25
+ }
26
+ ```
27
+
28
+ Bytes go into update, and the checksums comes out of digest.
29
+
30
+ Where possible, digest is non-destructive. That means you can digest to get a checksum, and then
31
+ keep adding more data with update.
32
+
33
+ Some checksums accept initial seeds.
34
+
35
+ | Algorithm | Digest length | Non-destructive digest | Accepts secret (HMAC) |
36
+ | --------- | ------------- | ------------------------ | --------------------- |
37
+ | Sha256 | 32 bytes | ✅ (only without secret) | ✅ |
38
+ | Sha1 | 20 bytes | ✅ (only without secret) | ✅ |
39
+ | Md5 | 16 bytes | ✅ | ❌ |
40
+ | Crc32 | 4 bytes | ✅ | ❌ |
41
+ | Crc32c | 4 bytes | ✅ | ❌ |
42
+ | Crc64Nvme | 8 bytes | ✅ | ❌ |
43
+
44
+ ## Selective API
45
+
46
+ By default, the canonically named checksum algorithms (above) will use the best implementation for
47
+ your bundling or runtime environment, some of which use natively available implementations.
48
+ All checksums have a pure JavaScript fallback. To use a specific implementation, you
49
+ can use the following implementation-specific import symbols, but this is not recommended.
50
+
51
+ ```ts
52
+ import {
53
+ // SHA1
54
+ Sha1Js,
55
+ Sha1Node,
56
+ Sha1WebCrypto,
57
+ // SHA256
58
+ Sha256Js,
59
+ Sha256Node,
60
+ } from "@aws-sdk/checksums/sha";
61
+ import { Md5Js, Md5Node } from "@aws-sdk/checksums/md5";
62
+ import {
63
+ // CRC32
64
+ Crc32Js,
65
+ Crc32Node,
66
+ // CRC32C
67
+ Crc32cJs,
68
+ Crc32cNode,
69
+ //CRC32NVME
70
+ Crc64Nvme,
71
+ Crc64NvmeJs,
72
+ } from "@aws-sdk/checksums/crc";
73
+ ```
74
+
75
+ Sha1Node, Sha256Node, and Md5Node use the `node:crypto` lib.
76
+
77
+ Sha1WebCrypto uses subtle crypto but falls back to JS when buffered data exceeds 8 MB.
78
+
79
+ Crc32Node uses `node:zlib`.
80
+
81
+ Crc64Nvme uses the AWS CRT if you load `@aws-sdk/crc64-nvme-crt`.
82
+
83
+ ## What does the AWS SDK do with this package?
84
+
85
+ The AWS SDK uses Sha256 for Signature V4 signing, Crc32 for event stream message integrity,
86
+ and all other algorithms are used for data integrity checksumming.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/checksums",
3
- "version": "3.1000.24",
3
+ "version": "3.1000.26",
4
4
  "description": "Checksum algorithms and flexible checksums middleware for the AWS SDK",
5
5
  "homepage": "https://github.com/aws/aws-sdk-js-v3/tree/main/packages-internal/checksums",
6
6
  "license": "Apache-2.0",
@@ -113,7 +113,7 @@
113
113
  "test:e2e:watch": "yarn g:vitest watch -c vitest.config.e2e.mts"
114
114
  },
115
115
  "dependencies": {
116
- "@aws-sdk/core": "^3.977.4",
116
+ "@aws-sdk/core": "^3.977.6",
117
117
  "@aws-sdk/types": "^3.974.2",
118
118
  "@smithy/core": "^3.31.1",
119
119
  "@smithy/types": "^4.16.1",