@smithy/core 3.26.0 → 3.28.0

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 (61) hide show
  1. package/dist-cjs/submodules/checksum/index.browser.js +358 -145
  2. package/dist-cjs/submodules/checksum/index.js +462 -142
  3. package/dist-cjs/submodules/checksum/index.native.js +358 -145
  4. package/dist-cjs/submodules/config/index.js +108 -63
  5. package/dist-cjs/submodules/event-streams/index.browser.js +11 -8
  6. package/dist-cjs/submodules/event-streams/index.js +11 -8
  7. package/dist-cjs/submodules/protocols/index.js +5 -2
  8. package/dist-cjs/submodules/serde/index.browser.js +30 -36
  9. package/dist-cjs/submodules/serde/index.js +54 -110
  10. package/dist-cjs/submodules/serde/index.native.js +30 -36
  11. package/dist-es/submodules/checksum/crc32/Crc32Js.js +30 -0
  12. package/dist-es/submodules/checksum/crc32/Crc32Node.js +24 -0
  13. package/dist-es/submodules/checksum/index.browser.js +7 -1
  14. package/dist-es/submodules/checksum/index.js +7 -1
  15. package/dist-es/submodules/checksum/index.native.js +7 -1
  16. package/dist-es/submodules/checksum/md5/Md5Js.js +92 -0
  17. package/dist-es/submodules/checksum/md5/Md5Node.js +29 -0
  18. package/dist-es/submodules/checksum/sha256/Sha256Js.js +179 -0
  19. package/dist-es/submodules/checksum/sha256/Sha256Node.js +59 -0
  20. package/dist-es/submodules/checksum/sha256/Sha256WebCrypto.js +71 -0
  21. package/dist-es/submodules/config/config-resolver/regionConfig/config.js +6 -1
  22. package/dist-es/submodules/config/config-resolver/regionConfig/getInstanceMetadataRegion.js +92 -0
  23. package/dist-es/submodules/config/defaults-mode/constants.js +3 -0
  24. package/dist-es/submodules/config/defaults-mode/resolveDefaultsModeConfig.js +3 -56
  25. package/dist-es/submodules/event-streams/eventstream-codec/EventStreamCodec.js +5 -3
  26. package/dist-es/submodules/event-streams/eventstream-codec/splitMessage.js +7 -6
  27. package/dist-es/submodules/protocols/HttpProtocol.js +4 -1
  28. package/dist-es/submodules/serde/concatBytes.js +15 -0
  29. package/dist-es/submodules/serde/index.browser.js +2 -0
  30. package/dist-es/submodules/serde/index.js +2 -0
  31. package/dist-es/submodules/serde/index.native.js +2 -0
  32. package/dist-es/submodules/serde/util-stream/checksum/ChecksumStream.js +4 -0
  33. package/dist-es/submodules/serde/util-stream/headStream.js +2 -1
  34. package/dist-es/submodules/serde/util-stream/stream-collector.browser.js +12 -38
  35. package/dist-es/submodules/serde/util-stream/stream-collector.js +18 -33
  36. package/dist-es/submodules/serde/util-utf8/toUint8Array.browser.js +3 -0
  37. package/dist-es/submodules/serde/util-utf8/toUint8Array.js +3 -0
  38. package/dist-types/submodules/checksum/crc32/Crc32Js.d.ts +18 -0
  39. package/dist-types/submodules/checksum/crc32/Crc32Node.d.ts +18 -0
  40. package/dist-types/submodules/checksum/index.browser.d.ts +7 -1
  41. package/dist-types/submodules/checksum/index.d.ts +7 -1
  42. package/dist-types/submodules/checksum/index.native.d.ts +7 -1
  43. package/dist-types/submodules/checksum/md5/Md5Js.d.ts +19 -0
  44. package/dist-types/submodules/checksum/md5/Md5Node.d.ts +17 -0
  45. package/dist-types/submodules/checksum/sha256/Sha256Js.d.ts +28 -0
  46. package/dist-types/submodules/checksum/sha256/Sha256Node.d.ts +13 -0
  47. package/dist-types/submodules/checksum/sha256/Sha256WebCrypto.d.ts +22 -0
  48. package/dist-types/submodules/config/config-resolver/regionConfig/getInstanceMetadataRegion.d.ts +7 -0
  49. package/dist-types/submodules/config/defaults-mode/constants.d.ts +12 -0
  50. package/dist-types/submodules/serde/concatBytes.d.ts +6 -0
  51. package/dist-types/submodules/serde/index.browser.d.ts +2 -0
  52. package/dist-types/submodules/serde/index.d.ts +2 -0
  53. package/dist-types/submodules/serde/index.native.d.ts +2 -0
  54. package/dist-types/submodules/serde/util-stream/checksum/ChecksumStream.d.ts +9 -0
  55. package/dist-types/submodules/serde/util-stream/stream-collector.browser.d.ts +8 -2
  56. package/dist-types/submodules/serde/util-stream/stream-collector.d.ts +4 -1
  57. package/package.json +4 -4
  58. package/dist-es/submodules/checksum/md5-js/constants.js +0 -3
  59. package/dist-es/submodules/checksum/md5-js/md5.js +0 -168
  60. package/dist-types/submodules/checksum/md5-js/constants.d.ts +0 -12
  61. package/dist-types/submodules/checksum/md5-js/md5.d.ts +0 -16
@@ -0,0 +1,22 @@
1
+ import type { Checksum, SourceData } from "@smithy/types";
2
+ /**
3
+ * SHA-256 using the Web Crypto API (crypto.subtle) when available,
4
+ * falling back to the pure JS implementation.
5
+ *
6
+ * Caution: this implementation is forced to buffer the data entirely.
7
+ * Use the pure-JS or Sha256Node implementations for large streaming data.
8
+ * @public
9
+ */
10
+ export declare class Sha256WebCrypto implements Checksum {
11
+ readonly digestLength: 32;
12
+ private readonly secret?;
13
+ private pending;
14
+ private pendingBytes;
15
+ private fallback?;
16
+ private finished;
17
+ constructor(secret?: SourceData);
18
+ update(data: Uint8Array): void;
19
+ digest(): Promise<Uint8Array>;
20
+ reset(): void;
21
+ private switchToFallback;
22
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Returns the region of the host from the EC2 Instance Metadata Service (IMDSv2),
3
+ * or undefined if unavailable.
4
+ *
5
+ * @internal
6
+ */
7
+ export declare const getInstanceMetadataRegion: () => Promise<string | undefined>;
@@ -22,3 +22,15 @@ export declare const DEFAULTS_MODE_OPTIONS: string[];
22
22
  * @internal
23
23
  */
24
24
  export declare const IMDS_REGION_PATH = "/latest/meta-data/placement/region";
25
+ /**
26
+ * @internal
27
+ */
28
+ export declare const IMDS_TOKEN_PATH = "/latest/api/token";
29
+ /**
30
+ * @internal
31
+ */
32
+ export declare const X_AWS_EC2_METADATA_TOKEN = "x-aws-ec2-metadata-token";
33
+ /**
34
+ * @internal
35
+ */
36
+ export declare const X_AWS_EC2_METADATA_TOKEN_TTL = "x-aws-ec2-metadata-token-ttl-seconds";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * This deliberately avoids differentiating to Buffer.concat in Node.js in favor of being isomorphic.
3
+ * This implementation pattern is highly recognizable/optimizable by JS engines.
4
+ * @internal
5
+ */
6
+ export declare function concatBytes(arrays: Uint8Array[], length?: number): Uint8Array;
@@ -16,6 +16,7 @@ export { toBase64, fromBase64 };
16
16
  export { calculateBodyLength } from "./util-body-length/calculateBodyLength.browser";
17
17
  export { toUint8Array } from "./util-utf8/toUint8Array.browser";
18
18
  export { toUtf8, fromUtf8 };
19
+ export { concatBytes } from "./concatBytes";
19
20
  export { type StringEncoding } from "./util-buffer-from/buffer-from";
20
21
  export declare const fromArrayBuffer: symbol;
21
22
  export declare const fromString: symbol;
@@ -35,5 +36,6 @@ export { headStream } from "./util-stream/headStream.browser";
35
36
  export { sdkStreamMixin } from "./util-stream/sdk-stream-mixin.browser";
36
37
  export { splitStream } from "./util-stream/splitStream.browser";
37
38
  export { isReadableStream, isBlob } from "./util-stream/stream-type-check";
39
+ export { streamCollector } from "./util-stream/stream-collector.browser";
38
40
  export declare const v4: () => string;
39
41
  export declare const generateIdempotencyToken: () => string;
@@ -16,6 +16,7 @@ export { toBase64, fromBase64 };
16
16
  export { calculateBodyLength } from "./util-body-length/calculateBodyLength";
17
17
  export { toUint8Array } from "./util-utf8/toUint8Array";
18
18
  export { toUtf8, fromUtf8 };
19
+ export { concatBytes } from "./concatBytes";
19
20
  export { fromArrayBuffer, fromString, type StringEncoding } from "./util-buffer-from/buffer-from";
20
21
  export { isArrayBuffer } from "./is-array-buffer/is-array-buffer";
21
22
  export { deserializerMiddleware } from "./middleware-serde/deserializerMiddleware";
@@ -33,5 +34,6 @@ export { headStream } from "./util-stream/headStream";
33
34
  export { sdkStreamMixin } from "./util-stream/sdk-stream-mixin";
34
35
  export { splitStream } from "./util-stream/splitStream";
35
36
  export { isReadableStream, isBlob } from "./util-stream/stream-type-check";
37
+ export { streamCollector } from "./util-stream/stream-collector";
36
38
  export declare const v4: () => string;
37
39
  export declare const generateIdempotencyToken: () => string;
@@ -14,6 +14,7 @@ export { calculateBodyLength } from "./util-body-length/calculateBodyLength.brow
14
14
  export { fromUtf8 } from "./util-utf8/fromUtf8.browser";
15
15
  export { toUint8Array } from "./util-utf8/toUint8Array.browser";
16
16
  export { toUtf8 } from "./util-utf8/toUtf8.browser";
17
+ export { concatBytes } from "./concatBytes";
17
18
  export { type StringEncoding } from "./util-buffer-from/buffer-from";
18
19
  export declare const fromArrayBuffer: symbol;
19
20
  export declare const fromString: symbol;
@@ -33,5 +34,6 @@ export { headStream } from "./util-stream/headStream.browser";
33
34
  export { sdkStreamMixin } from "./util-stream/sdk-stream-mixin.browser";
34
35
  export { splitStream } from "./util-stream/splitStream.browser";
35
36
  export { isReadableStream, isBlob } from "./util-stream/stream-type-check";
37
+ export { streamCollector } from "./util-stream/stream-collector.browser";
36
38
  export declare const v4: () => string;
37
39
  export declare const generateIdempotencyToken: () => string;
@@ -57,4 +57,13 @@ export declare class ChecksumStream extends Duplex {
57
57
  * @internal
58
58
  */
59
59
  _final(callback: (err?: Error) => void): Promise<void>;
60
+ /**
61
+ * Destroy the upstream source for cleanup so it is not left dangling, then
62
+ * complete this stream's destruction. The error is intentionally not forwarded
63
+ * to the source as the source is typically internal and without an error listener
64
+ * The error still surfaces on this stream via the callback.
65
+ * Do not call this directly.
66
+ * @internal
67
+ */
68
+ _destroy(error: Error | null, callback: (error?: Error | null | undefined) => void): void;
60
69
  }
@@ -1,6 +1,12 @@
1
1
  /**
2
- * Inlined from @smithy/fetch-http-handler streamCollector.
3
- *
4
2
  * @internal
5
3
  */
6
4
  export declare const streamCollector: (stream: Blob | ReadableStream) => Promise<Uint8Array>;
5
+ /**
6
+ * @internal
7
+ */
8
+ export declare function collectBlob(blob: Blob): Promise<Uint8Array>;
9
+ /**
10
+ * @internal
11
+ */
12
+ export declare function collectReadableStream(stream: ReadableStream): Promise<Uint8Array>;
@@ -1,3 +1,6 @@
1
1
  import { type Readable } from "node:stream";
2
2
  import type { ReadableStream as IReadableStream } from "node:stream/web";
3
- export declare const streamCollector: (stream: Readable | IReadableStream) => Promise<Uint8Array>;
3
+ /**
4
+ * @internal
5
+ */
6
+ export declare const streamCollector: (stream: Readable | IReadableStream | ReadableStream | Blob) => Promise<Uint8Array>;
package/package.json CHANGED
@@ -1,7 +1,9 @@
1
1
  {
2
2
  "name": "@smithy/core",
3
- "version": "3.26.0",
3
+ "version": "3.28.0",
4
4
  "scripts": {
5
+ "benchmark:cbor": "node ./scripts/cbor-perf.mjs",
6
+ "benchmark:checksum": "node ./scripts/checksum-perf.mjs",
5
7
  "build": "concurrently 'yarn:build:types' 'yarn:build:es:cjs'",
6
8
  "build:es:cjs": "premove dist-es && yarn g:tsc -p tsconfig.es.json && node ../../scripts/inline",
7
9
  "build:types": "premove dist-types && yarn g:tsc -p tsconfig.types.json",
@@ -15,8 +17,7 @@
15
17
  "test": "yarn g:vitest run",
16
18
  "test:watch": "yarn g:vitest watch",
17
19
  "test:integration": "yarn g:vitest run -c vitest.config.integ.mts",
18
- "test:integration:watch": "yarn g:vitest watch -c vitest.config.integ.mts",
19
- "test:cbor:perf": "node ./scripts/cbor-perf.mjs"
20
+ "test:integration:watch": "yarn g:vitest watch -c vitest.config.integ.mts"
20
21
  },
21
22
  "main": "./dist-cjs/index.js",
22
23
  "module": "./dist-es/index.js",
@@ -169,7 +170,6 @@
169
170
  "license": "Apache-2.0",
170
171
  "sideEffects": false,
171
172
  "dependencies": {
172
- "@aws-crypto/crc32": "5.2.0",
173
173
  "@smithy/types": "^4.15.0",
174
174
  "tslib": "^2.6.2"
175
175
  },
@@ -1,3 +0,0 @@
1
- export const BLOCK_SIZE = 64;
2
- export const DIGEST_LENGTH = 16;
3
- export const INIT = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476];
@@ -1,168 +0,0 @@
1
- import { fromUtf8 } from "@smithy/core/serde";
2
- import { BLOCK_SIZE, DIGEST_LENGTH, INIT } from "./constants";
3
- export class Md5 {
4
- state;
5
- buffer;
6
- bufferLength;
7
- bytesHashed;
8
- finished;
9
- constructor() {
10
- this.reset();
11
- }
12
- update(sourceData) {
13
- if (isEmptyData(sourceData)) {
14
- return;
15
- }
16
- else if (this.finished) {
17
- throw new Error("Attempted to update an already finished hash.");
18
- }
19
- const data = convertToBuffer(sourceData);
20
- let position = 0;
21
- let { byteLength } = data;
22
- this.bytesHashed += byteLength;
23
- while (byteLength > 0) {
24
- this.buffer.setUint8(this.bufferLength++, data[position++]);
25
- byteLength--;
26
- if (this.bufferLength === BLOCK_SIZE) {
27
- this.hashBuffer();
28
- this.bufferLength = 0;
29
- }
30
- }
31
- }
32
- async digest() {
33
- if (!this.finished) {
34
- const { buffer, bufferLength: undecoratedLength, bytesHashed } = this;
35
- const bitsHashed = bytesHashed * 8;
36
- buffer.setUint8(this.bufferLength++, 0b10000000);
37
- if (undecoratedLength % BLOCK_SIZE >= BLOCK_SIZE - 8) {
38
- for (let i = this.bufferLength; i < BLOCK_SIZE; i++) {
39
- buffer.setUint8(i, 0);
40
- }
41
- this.hashBuffer();
42
- this.bufferLength = 0;
43
- }
44
- for (let i = this.bufferLength; i < BLOCK_SIZE - 8; i++) {
45
- buffer.setUint8(i, 0);
46
- }
47
- buffer.setUint32(BLOCK_SIZE - 8, bitsHashed >>> 0, true);
48
- buffer.setUint32(BLOCK_SIZE - 4, Math.floor(bitsHashed / 0x100000000), true);
49
- this.hashBuffer();
50
- this.finished = true;
51
- }
52
- const out = new DataView(new ArrayBuffer(DIGEST_LENGTH));
53
- for (let i = 0; i < 4; i++) {
54
- out.setUint32(i * 4, this.state[i], true);
55
- }
56
- return new Uint8Array(out.buffer, out.byteOffset, out.byteLength);
57
- }
58
- hashBuffer() {
59
- const { buffer, state } = this;
60
- let a = state[0], b = state[1], c = state[2], d = state[3];
61
- a = ff(a, b, c, d, buffer.getUint32(0, true), 7, 0xd76aa478);
62
- d = ff(d, a, b, c, buffer.getUint32(4, true), 12, 0xe8c7b756);
63
- c = ff(c, d, a, b, buffer.getUint32(8, true), 17, 0x242070db);
64
- b = ff(b, c, d, a, buffer.getUint32(12, true), 22, 0xc1bdceee);
65
- a = ff(a, b, c, d, buffer.getUint32(16, true), 7, 0xf57c0faf);
66
- d = ff(d, a, b, c, buffer.getUint32(20, true), 12, 0x4787c62a);
67
- c = ff(c, d, a, b, buffer.getUint32(24, true), 17, 0xa8304613);
68
- b = ff(b, c, d, a, buffer.getUint32(28, true), 22, 0xfd469501);
69
- a = ff(a, b, c, d, buffer.getUint32(32, true), 7, 0x698098d8);
70
- d = ff(d, a, b, c, buffer.getUint32(36, true), 12, 0x8b44f7af);
71
- c = ff(c, d, a, b, buffer.getUint32(40, true), 17, 0xffff5bb1);
72
- b = ff(b, c, d, a, buffer.getUint32(44, true), 22, 0x895cd7be);
73
- a = ff(a, b, c, d, buffer.getUint32(48, true), 7, 0x6b901122);
74
- d = ff(d, a, b, c, buffer.getUint32(52, true), 12, 0xfd987193);
75
- c = ff(c, d, a, b, buffer.getUint32(56, true), 17, 0xa679438e);
76
- b = ff(b, c, d, a, buffer.getUint32(60, true), 22, 0x49b40821);
77
- a = gg(a, b, c, d, buffer.getUint32(4, true), 5, 0xf61e2562);
78
- d = gg(d, a, b, c, buffer.getUint32(24, true), 9, 0xc040b340);
79
- c = gg(c, d, a, b, buffer.getUint32(44, true), 14, 0x265e5a51);
80
- b = gg(b, c, d, a, buffer.getUint32(0, true), 20, 0xe9b6c7aa);
81
- a = gg(a, b, c, d, buffer.getUint32(20, true), 5, 0xd62f105d);
82
- d = gg(d, a, b, c, buffer.getUint32(40, true), 9, 0x02441453);
83
- c = gg(c, d, a, b, buffer.getUint32(60, true), 14, 0xd8a1e681);
84
- b = gg(b, c, d, a, buffer.getUint32(16, true), 20, 0xe7d3fbc8);
85
- a = gg(a, b, c, d, buffer.getUint32(36, true), 5, 0x21e1cde6);
86
- d = gg(d, a, b, c, buffer.getUint32(56, true), 9, 0xc33707d6);
87
- c = gg(c, d, a, b, buffer.getUint32(12, true), 14, 0xf4d50d87);
88
- b = gg(b, c, d, a, buffer.getUint32(32, true), 20, 0x455a14ed);
89
- a = gg(a, b, c, d, buffer.getUint32(52, true), 5, 0xa9e3e905);
90
- d = gg(d, a, b, c, buffer.getUint32(8, true), 9, 0xfcefa3f8);
91
- c = gg(c, d, a, b, buffer.getUint32(28, true), 14, 0x676f02d9);
92
- b = gg(b, c, d, a, buffer.getUint32(48, true), 20, 0x8d2a4c8a);
93
- a = hh(a, b, c, d, buffer.getUint32(20, true), 4, 0xfffa3942);
94
- d = hh(d, a, b, c, buffer.getUint32(32, true), 11, 0x8771f681);
95
- c = hh(c, d, a, b, buffer.getUint32(44, true), 16, 0x6d9d6122);
96
- b = hh(b, c, d, a, buffer.getUint32(56, true), 23, 0xfde5380c);
97
- a = hh(a, b, c, d, buffer.getUint32(4, true), 4, 0xa4beea44);
98
- d = hh(d, a, b, c, buffer.getUint32(16, true), 11, 0x4bdecfa9);
99
- c = hh(c, d, a, b, buffer.getUint32(28, true), 16, 0xf6bb4b60);
100
- b = hh(b, c, d, a, buffer.getUint32(40, true), 23, 0xbebfbc70);
101
- a = hh(a, b, c, d, buffer.getUint32(52, true), 4, 0x289b7ec6);
102
- d = hh(d, a, b, c, buffer.getUint32(0, true), 11, 0xeaa127fa);
103
- c = hh(c, d, a, b, buffer.getUint32(12, true), 16, 0xd4ef3085);
104
- b = hh(b, c, d, a, buffer.getUint32(24, true), 23, 0x04881d05);
105
- a = hh(a, b, c, d, buffer.getUint32(36, true), 4, 0xd9d4d039);
106
- d = hh(d, a, b, c, buffer.getUint32(48, true), 11, 0xe6db99e5);
107
- c = hh(c, d, a, b, buffer.getUint32(60, true), 16, 0x1fa27cf8);
108
- b = hh(b, c, d, a, buffer.getUint32(8, true), 23, 0xc4ac5665);
109
- a = ii(a, b, c, d, buffer.getUint32(0, true), 6, 0xf4292244);
110
- d = ii(d, a, b, c, buffer.getUint32(28, true), 10, 0x432aff97);
111
- c = ii(c, d, a, b, buffer.getUint32(56, true), 15, 0xab9423a7);
112
- b = ii(b, c, d, a, buffer.getUint32(20, true), 21, 0xfc93a039);
113
- a = ii(a, b, c, d, buffer.getUint32(48, true), 6, 0x655b59c3);
114
- d = ii(d, a, b, c, buffer.getUint32(12, true), 10, 0x8f0ccc92);
115
- c = ii(c, d, a, b, buffer.getUint32(40, true), 15, 0xffeff47d);
116
- b = ii(b, c, d, a, buffer.getUint32(4, true), 21, 0x85845dd1);
117
- a = ii(a, b, c, d, buffer.getUint32(32, true), 6, 0x6fa87e4f);
118
- d = ii(d, a, b, c, buffer.getUint32(60, true), 10, 0xfe2ce6e0);
119
- c = ii(c, d, a, b, buffer.getUint32(24, true), 15, 0xa3014314);
120
- b = ii(b, c, d, a, buffer.getUint32(52, true), 21, 0x4e0811a1);
121
- a = ii(a, b, c, d, buffer.getUint32(16, true), 6, 0xf7537e82);
122
- d = ii(d, a, b, c, buffer.getUint32(44, true), 10, 0xbd3af235);
123
- c = ii(c, d, a, b, buffer.getUint32(8, true), 15, 0x2ad7d2bb);
124
- b = ii(b, c, d, a, buffer.getUint32(36, true), 21, 0xeb86d391);
125
- state[0] = (a + state[0]) & 0xffffffff;
126
- state[1] = (b + state[1]) & 0xffffffff;
127
- state[2] = (c + state[2]) & 0xffffffff;
128
- state[3] = (d + state[3]) & 0xffffffff;
129
- }
130
- reset() {
131
- this.state = Uint32Array.from(INIT);
132
- this.buffer = new DataView(new ArrayBuffer(BLOCK_SIZE));
133
- this.bufferLength = 0;
134
- this.bytesHashed = 0;
135
- this.finished = false;
136
- }
137
- }
138
- function cmn(q, a, b, x, s, t) {
139
- a = (((a + q) & 0xffffffff) + ((x + t) & 0xffffffff)) & 0xffffffff;
140
- return (((a << s) | (a >>> (32 - s))) + b) & 0xffffffff;
141
- }
142
- function ff(a, b, c, d, x, s, t) {
143
- return cmn((b & c) | (~b & d), a, b, x, s, t);
144
- }
145
- function gg(a, b, c, d, x, s, t) {
146
- return cmn((b & d) | (c & ~d), a, b, x, s, t);
147
- }
148
- function hh(a, b, c, d, x, s, t) {
149
- return cmn(b ^ c ^ d, a, b, x, s, t);
150
- }
151
- function ii(a, b, c, d, x, s, t) {
152
- return cmn(c ^ (b | ~d), a, b, x, s, t);
153
- }
154
- function isEmptyData(data) {
155
- if (typeof data === "string") {
156
- return data.length === 0;
157
- }
158
- return data.byteLength === 0;
159
- }
160
- function convertToBuffer(data) {
161
- if (typeof data === "string") {
162
- return fromUtf8(data);
163
- }
164
- if (ArrayBuffer.isView(data)) {
165
- return new Uint8Array(data.buffer, data.byteOffset, data.byteLength / Uint8Array.BYTES_PER_ELEMENT);
166
- }
167
- return new Uint8Array(data);
168
- }
@@ -1,12 +0,0 @@
1
- /**
2
- * @internal
3
- */
4
- export declare const BLOCK_SIZE = 64;
5
- /**
6
- * @internal
7
- */
8
- export declare const DIGEST_LENGTH = 16;
9
- /**
10
- * @internal
11
- */
12
- export declare const INIT: number[];
@@ -1,16 +0,0 @@
1
- import type { Checksum, SourceData } from "@smithy/types";
2
- /**
3
- * @internal
4
- */
5
- export declare class Md5 implements Checksum {
6
- private state;
7
- private buffer;
8
- private bufferLength;
9
- private bytesHashed;
10
- private finished;
11
- constructor();
12
- update(sourceData: SourceData): void;
13
- digest(): Promise<Uint8Array>;
14
- private hashBuffer;
15
- reset(): void;
16
- }