@stryke/hash 0.12.15 → 0.12.23

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 (86) hide show
  1. package/CHANGELOG.md +391 -0
  2. package/README.md +18 -9
  3. package/dist/digest-311IQaur.mjs +2 -0
  4. package/dist/digest-311IQaur.mjs.map +1 -0
  5. package/dist/digest-CG1Sk96A.d.mts +32 -0
  6. package/dist/digest-CG1Sk96A.d.mts.map +1 -0
  7. package/dist/digest-REorjd4v.cjs +1 -0
  8. package/dist/digest-Yy26O9oW.d.cts +32 -0
  9. package/dist/digest-Yy26O9oW.d.cts.map +1 -0
  10. package/dist/digest.cjs +1 -36
  11. package/dist/digest.d.cts +2 -0
  12. package/dist/digest.d.mts +2 -0
  13. package/dist/digest.mjs +1 -1
  14. package/dist/{etag.d.ts → etag-BdoEX_I_.d.cts} +6 -2
  15. package/dist/etag-BdoEX_I_.d.cts.map +1 -0
  16. package/dist/etag-DXmoR6hr.mjs +2 -0
  17. package/dist/etag-DXmoR6hr.mjs.map +1 -0
  18. package/dist/etag-Kuj0WZon.d.mts +22 -0
  19. package/dist/etag-Kuj0WZon.d.mts.map +1 -0
  20. package/dist/etag-SIhKWCBx.cjs +1 -0
  21. package/dist/etag.cjs +1 -23
  22. package/dist/etag.d.cts +2 -0
  23. package/dist/etag.d.mts +2 -0
  24. package/dist/etag.mjs +1 -1
  25. package/dist/hash-files-BMmt9LzB.mjs +2 -0
  26. package/dist/hash-files-BMmt9LzB.mjs.map +1 -0
  27. package/dist/hash-files-C8KCroZK.d.mts +26 -0
  28. package/dist/hash-files-C8KCroZK.d.mts.map +1 -0
  29. package/dist/hash-files-DMXzIbQw.d.cts +26 -0
  30. package/dist/hash-files-DMXzIbQw.d.cts.map +1 -0
  31. package/dist/hash-files-DNDrDY17.cjs +1 -0
  32. package/dist/hash-files.cjs +1 -19
  33. package/dist/hash-files.d.cts +2 -0
  34. package/dist/hash-files.d.mts +2 -0
  35. package/dist/hash-files.mjs +1 -1
  36. package/dist/index.cjs +1 -71
  37. package/dist/index.d.cts +7 -0
  38. package/dist/index.d.mts +7 -0
  39. package/dist/index.mjs +1 -1
  40. package/dist/{md5.d.ts → md5-CCxA7tZv.d.cts} +5 -1
  41. package/dist/md5-CCxA7tZv.d.cts.map +1 -0
  42. package/dist/md5-C_8IsDev.d.mts +12 -0
  43. package/dist/md5-C_8IsDev.d.mts.map +1 -0
  44. package/dist/md5-CnYTBU9u.mjs +2 -0
  45. package/dist/md5-CnYTBU9u.mjs.map +1 -0
  46. package/dist/md5-Cwdph7YU.cjs +1 -0
  47. package/dist/md5.cjs +1 -10
  48. package/dist/md5.d.cts +2 -0
  49. package/dist/md5.d.mts +2 -0
  50. package/dist/md5.mjs +1 -1
  51. package/dist/murmurhash-CVcuhG5F.cjs +1 -0
  52. package/dist/murmurhash-CoNWpOwZ.mjs +2 -0
  53. package/dist/murmurhash-CoNWpOwZ.mjs.map +1 -0
  54. package/dist/murmurhash-D6qhmMhz.d.mts +23 -0
  55. package/dist/murmurhash-D6qhmMhz.d.mts.map +1 -0
  56. package/dist/murmurhash-dzYfmtjT.d.cts +23 -0
  57. package/dist/murmurhash-dzYfmtjT.d.cts.map +1 -0
  58. package/dist/murmurhash.cjs +1 -12
  59. package/dist/murmurhash.d.cts +2 -0
  60. package/dist/murmurhash.d.mts +2 -0
  61. package/dist/murmurhash.mjs +1 -1
  62. package/dist/neutral.cjs +1 -49
  63. package/dist/neutral.d.cts +5 -0
  64. package/dist/neutral.d.mts +5 -0
  65. package/dist/neutral.mjs +1 -1
  66. package/dist/src-GI5wB-mz.mjs +2 -0
  67. package/dist/src-GI5wB-mz.mjs.map +1 -0
  68. package/dist/src-QUlAu3to.cjs +1 -0
  69. package/dist/xx-hash--6giOvM7.cjs +1 -0
  70. package/dist/xx-hash-BnLXga7m.d.cts +7 -0
  71. package/dist/xx-hash-BnLXga7m.d.cts.map +1 -0
  72. package/dist/xx-hash-DyeY-GKZ.d.mts +7 -0
  73. package/dist/xx-hash-DyeY-GKZ.d.mts.map +1 -0
  74. package/dist/xx-hash-SyVhkkcA.mjs +2 -0
  75. package/dist/xx-hash-SyVhkkcA.mjs.map +1 -0
  76. package/dist/xx-hash.cjs +1 -18
  77. package/dist/xx-hash.d.cts +2 -0
  78. package/dist/xx-hash.d.mts +2 -0
  79. package/dist/xx-hash.mjs +1 -1
  80. package/package.json +26 -146
  81. package/dist/digest.d.ts +0 -28
  82. package/dist/hash-files.d.ts +0 -18
  83. package/dist/index.d.ts +0 -14
  84. package/dist/murmurhash.d.ts +0 -19
  85. package/dist/neutral.d.ts +0 -4
  86. package/dist/xx-hash.d.ts +0 -3
package/CHANGELOG.md ADDED
@@ -0,0 +1,391 @@
1
+ ![Storm Software's logo banner](https://public.storm-cdn.com/storm-software/banner-1280x320-optimized.gif)
2
+
3
+ # Changelog for Stryke - Hash
4
+
5
+ ## [0.12.22](https://github.com/storm-software/stryke/releases/tag/hash%400.12.22) (12/07/2025)
6
+
7
+ ### Updated Dependencies
8
+
9
+ - Updated **convert** to **v0.6.20**
10
+ - Updated **fs** to **v0.33.16**
11
+
12
+ ## [0.12.21](https://github.com/storm-software/stryke/releases/tag/hash%400.12.21) (12/07/2025)
13
+
14
+ ### Updated Dependencies
15
+
16
+ - Updated **convert** to **v0.6.19**
17
+ - Updated **fs** to **v0.33.15**
18
+
19
+ ## [0.12.20](https://github.com/storm-software/stryke/releases/tag/hash%400.12.20) (12/07/2025)
20
+
21
+ ### Miscellaneous
22
+
23
+ - **monorepo:** Format monorepo source files
24
+ ([9428936](https://github.com/storm-software/stryke/commit/9428936))
25
+
26
+ ### Updated Dependencies
27
+
28
+ - Updated **convert** to **v0.6.18**
29
+ - Updated **fs** to **v0.33.14**
30
+
31
+ ## [0.12.19](https://github.com/storm-software/stryke/releases/tag/hash%400.12.19) (12/06/2025)
32
+
33
+ ### Features
34
+
35
+ - **tools-nx:** Resolved issue inferring build command-line arguments for local
36
+ packages ([de00278](https://github.com/storm-software/stryke/commit/de00278))
37
+
38
+ ### Updated Dependencies
39
+
40
+ - Updated **convert** to **v0.6.17**
41
+ - Updated **fs** to **v0.33.13**
42
+
43
+ ## [0.12.18](https://github.com/storm-software/stryke/releases/tag/hash%400.12.18) (12/06/2025)
44
+
45
+ ### Updated Dependencies
46
+
47
+ - Updated **convert** to **v0.6.16**
48
+ - Updated **fs** to **v0.33.12**
49
+
50
+ ## [0.12.17](https://github.com/storm-software/stryke/releases/tag/hash%400.12.17) (12/05/2025)
51
+
52
+ ### Updated Dependencies
53
+
54
+ - Updated **convert** to **v0.6.15**
55
+ - Updated **fs** to **v0.33.11**
56
+
57
+ ## [0.12.16](https://github.com/storm-software/stryke/releases/tag/hash%400.12.16) (12/05/2025)
58
+
59
+ ### Features
60
+
61
+ - **monorepo:** Update repository to use `tsdown` to build/bundle packages
62
+ ([8ceb909](https://github.com/storm-software/stryke/commit/8ceb909))
63
+
64
+ ### Updated Dependencies
65
+
66
+ - Updated **convert** to **v0.6.14**
67
+ - Updated **fs** to **v0.33.10**
68
+
69
+ ## [0.12.15](https://github.com/storm-software/stryke/releases/tag/hash%400.12.15) (12/01/2025)
70
+
71
+ ### Updated Dependencies
72
+
73
+ - Updated **convert** to **v0.6.13**
74
+ - Updated **fs** to **v0.33.9**
75
+
76
+ ## [0.12.14](https://github.com/storm-software/stryke/releases/tag/hash%400.12.14) (11/30/2025)
77
+
78
+ ### Updated Dependencies
79
+
80
+ - Updated **convert** to **v0.6.12**
81
+ - Updated **fs** to **v0.33.8**
82
+
83
+ ## [0.12.13](https://github.com/storm-software/stryke/releases/tag/hash%400.12.13) (11/30/2025)
84
+
85
+ ### Updated Dependencies
86
+
87
+ - Updated **convert** to **v0.6.11**
88
+ - Updated **fs** to **v0.33.7**
89
+
90
+ ## [0.12.12](https://github.com/storm-software/stryke/releases/tag/hash%400.12.12) (11/30/2025)
91
+
92
+ ### Updated Dependencies
93
+
94
+ - Updated **convert** to **v0.6.10**
95
+ - Updated **fs** to **v0.33.6**
96
+
97
+ ## [0.12.11](https://github.com/storm-software/stryke/releases/tag/hash%400.12.11) (11/30/2025)
98
+
99
+ ### Updated Dependencies
100
+
101
+ - Updated **convert** to **v0.6.9**
102
+ - Updated **fs** to **v0.33.5**
103
+
104
+ ## [0.12.10](https://github.com/storm-software/stryke/releases/tag/hash%400.12.10) (11/24/2025)
105
+
106
+ ### Updated Dependencies
107
+
108
+ - Updated **convert** to **v0.6.8**
109
+ - Updated **fs** to **v0.33.4**
110
+
111
+ ## [0.12.9](https://github.com/storm-software/stryke/releases/tag/hash%400.12.9) (11/21/2025)
112
+
113
+ ### Updated Dependencies
114
+
115
+ - Updated **convert** to **v0.6.7**
116
+ - Updated **fs** to **v0.33.3**
117
+
118
+ ## [0.12.8](https://github.com/storm-software/stryke/releases/tag/hash%400.12.8) (11/21/2025)
119
+
120
+ ### Updated Dependencies
121
+
122
+ - Updated **convert** to **v0.6.6**
123
+ - Updated **fs** to **v0.33.2**
124
+
125
+ ## [0.12.7](https://github.com/storm-software/stryke/releases/tag/hash%400.12.7) (11/21/2025)
126
+
127
+ ### Updated Dependencies
128
+
129
+ - Updated **fs** to **v0.33.1**
130
+
131
+ ## [0.12.6](https://github.com/storm-software/stryke/releases/tag/hash%400.12.6) (11/21/2025)
132
+
133
+ ### Updated Dependencies
134
+
135
+ - Updated **convert** to **v0.6.5**
136
+ - Updated **fs** to **v0.33.0**
137
+
138
+ ## [0.12.5](https://github.com/storm-software/stryke/releases/tag/hash%400.12.5) (11/21/2025)
139
+
140
+ ### Updated Dependencies
141
+
142
+ - Updated **convert** to **v0.6.4**
143
+ - Updated **fs** to **v0.32.15**
144
+
145
+ ## [0.12.4](https://github.com/storm-software/stryke/releases/tag/hash%400.12.4) (11/21/2025)
146
+
147
+ ### Updated Dependencies
148
+
149
+ - Updated **convert** to **v0.6.3**
150
+ - Updated **fs** to **v0.32.14**
151
+
152
+ ## [0.12.3](https://github.com/storm-software/stryke/releases/tag/hash%400.12.3) (11/16/2025)
153
+
154
+ ### Updated Dependencies
155
+
156
+ - Updated **fs** to **v0.32.13**
157
+
158
+ ## [0.12.2](https://github.com/storm-software/stryke/releases/tag/hash%400.12.2) (11/16/2025)
159
+
160
+ ### Updated Dependencies
161
+
162
+ - Updated **convert** to **v0.6.2**
163
+ - Updated **fs** to **v0.32.12**
164
+
165
+ ## [0.12.1](https://github.com/storm-software/stryke/releases/tag/hash%400.12.1) (11/08/2025)
166
+
167
+ ### Updated Dependencies
168
+
169
+ - Updated **convert** to **v0.6.1**
170
+ - Updated **fs** to **v0.32.11**
171
+
172
+ ## [0.12.0](https://github.com/storm-software/stryke/releases/tag/hash%400.12.0) (2025-09-19)
173
+
174
+ ### Features
175
+
176
+ - **hash:** Split package between `neutral` and `node` exports
177
+ ([870bbeb](https://github.com/storm-software/stryke/commit/870bbeb))
178
+
179
+ ## [0.11.0](https://github.com/storm-software/stryke/releases/tag/hash%400.11.0) (2025-09-07)
180
+
181
+ ### Features
182
+
183
+ - **hash:** Added the `etag` helper utility
184
+ ([20ccaae](https://github.com/storm-software/stryke/commit/20ccaae))
185
+
186
+ ![Storm Software](https://public.storm-cdn.com/brand-banner.png)
187
+
188
+ # Changelog for Stryke - Hash
189
+
190
+ ## [0.10.0](https://github.com/storm-software/stryke/releases/tag/hash%400.10.0) (2025-07-04)
191
+
192
+ ### Features
193
+
194
+ - **hash:** Added the 'MD5' hash utility function
195
+ ([1b62648](https://github.com/storm-software/stryke/commit/1b62648))
196
+
197
+ ## [0.9.7](https://github.com/storm-software/stryke/releases/tag/hash%400.9.7) (2025-06-17)
198
+
199
+ ### Miscellaneous
200
+
201
+ - **monorepo:** Reformat repository packages
202
+
203
+ ## [0.9.6](https://github.com/storm-software/stryke/releases/tag/hash%400.9.6) (2025-06-12)
204
+
205
+ ### Miscellaneous
206
+
207
+ - **monorepo:** Reformat the repository's README markdown files
208
+ - **monorepo:** Run format script on repository
209
+
210
+ ## [0.9.5](https://github.com/storm-software/stryke/releases/tag/hash%400.9.5) (2025-06-10)
211
+
212
+ ### Miscellaneous
213
+
214
+ - **hash:** Update package formatting
215
+
216
+ ## [0.9.4](https://github.com/storm-software/stryke/releases/tag/hash%400.9.4) (2025-06-06)
217
+
218
+ ### Miscellaneous
219
+
220
+ - **monorepo:** Run workspace formatting in package
221
+
222
+ ## [0.9.3](https://github.com/storm-software/stryke/releases/tag/hash%400.9.3) (2025-05-12)
223
+
224
+ ### Miscellaneous
225
+
226
+ - **monorepo:** Reformat monorepo source code
227
+
228
+ ## [0.9.2](https://github.com/storm-software/stryke/releases/tag/hash%400.9.2) (2025-04-10)
229
+
230
+ ### Bug Fixes
231
+
232
+ - **hash:** Resolved issue with invalid option names in `hashDirectory`
233
+ ([0181506](https://github.com/storm-software/stryke/commit/0181506))
234
+
235
+ ## [0.9.1](https://github.com/storm-software/stryke/releases/tag/hash%400.9.1) (2025-04-10)
236
+
237
+ ### Miscellaneous
238
+
239
+ - **monorepo:** Format the repository's files
240
+ ([1384f3e](https://github.com/storm-software/stryke/commit/1384f3e))
241
+
242
+ ## [0.9.0](https://github.com/storm-software/stryke/releases/tag/hash%400.9.0) (2025-04-02)
243
+
244
+ ### Features
245
+
246
+ - **hash:** Update hash function to use `ohash` package
247
+ ([1e4efa0](https://github.com/storm-software/stryke/commit/1e4efa0))
248
+
249
+ ## [0.8.4](https://github.com/storm-software/stryke/releases/tag/hash%400.8.4) (2025-03-28)
250
+
251
+ ### Miscellaneous
252
+
253
+ - **monorepo:** Reformat the source files in repository
254
+ ([bb8df2c](https://github.com/storm-software/stryke/commit/bb8df2c))
255
+
256
+ ## [0.8.3](https://github.com/storm-software/stryke/releases/tag/hash%400.8.3) (2025-03-23)
257
+
258
+ ### Bug Fixes
259
+
260
+ - **monorepo:** Resolve issue with TypeScript compilation
261
+ ([72e995f](https://github.com/storm-software/stryke/commit/72e995f))
262
+
263
+ ## [0.8.2](https://github.com/storm-software/stryke/releases/tag/hash%400.8.2) (2025-03-23)
264
+
265
+ ### Miscellaneous
266
+
267
+ - **monorepo:** Update base storm software packages
268
+ ([8942201](https://github.com/storm-software/stryke/commit/8942201))
269
+
270
+ ## 0.8.1 (2025-03-13)
271
+
272
+ ### Miscellaneous
273
+
274
+ - **monorepo:** Format monorepo project files
275
+ ([f28fdbe](https://github.com/storm-software/stryke/commit/f28fdbe))
276
+
277
+ ## 0.8.0 (2025-03-13)
278
+
279
+ ### Features
280
+
281
+ - **monorepo:** Split `types` project into `type-checks` and `convert` packages
282
+ ([fcc5832](https://github.com/storm-software/stryke/commit/fcc5832))
283
+ - **fs:** Moved the helper functions to root package directory
284
+ ([9e77f62](https://github.com/storm-software/stryke/commit/9e77f62))
285
+
286
+ ## 0.7.3 (2025-03-13)
287
+
288
+ ### Miscellaneous
289
+
290
+ - **monorepo:** Reformat monorepo package files
291
+ ([a453428](https://github.com/storm-software/stryke/commit/a453428))
292
+
293
+ ## 0.7.2 (2025-03-13)
294
+
295
+ ### Bug Fixes
296
+
297
+ - **path:** Resolve issue formatting paths in `joinPaths` helper
298
+ ([0270f8d](https://github.com/storm-software/stryke/commit/0270f8d))
299
+
300
+ ## 0.7.1 (2025-03-07)
301
+
302
+ ### Bug Fixes
303
+
304
+ - **hash:** Resolve issue with invalid file operations
305
+ ([7d85143](https://github.com/storm-software/stryke/commit/7d85143))
306
+
307
+ ## 0.7.0 (2025-03-06)
308
+
309
+ ### Features
310
+
311
+ - **hash:** Added additional patterns to `ignores` list for `hashDirectory`
312
+ function ([649700f](https://github.com/storm-software/stryke/commit/649700f))
313
+
314
+ ## 0.6.0 (2025-03-06)
315
+
316
+ ### Features
317
+
318
+ - **fs:** Added the options parameter to the `listFiles` helper function
319
+ ([630be63](https://github.com/storm-software/stryke/commit/630be63))
320
+
321
+ ## 0.5.1 (2025-02-26)
322
+
323
+ ### Miscellaneous
324
+
325
+ - **monorepo:** Reformat monorepo files with `prettier`
326
+ ([b5d0302](https://github.com/storm-software/stryke/commit/b5d0302))
327
+
328
+ ## 0.5.0 (2025-02-26)
329
+
330
+ ### Features
331
+
332
+ - **fs:** Added `listFiles` helper function
333
+ ([dc1b847](https://github.com/storm-software/stryke/commit/dc1b847))
334
+ - **hash:** Added the `hashFiles` and renamed `hashDirectory` helpers
335
+ ([15cc347](https://github.com/storm-software/stryke/commit/15cc347))
336
+
337
+ ## 0.4.0 (2025-02-26)
338
+
339
+ ### Features
340
+
341
+ - **hash:** Added the `hashFolder` function
342
+ ([c6e4ff3](https://github.com/storm-software/stryke/commit/c6e4ff3))
343
+
344
+ ## 0.3.0 (2025-02-23)
345
+
346
+ ### Features
347
+
348
+ - **monorepo:** Update base ESLint packages and run on files
349
+ ([c59cb8e](https://github.com/storm-software/stryke/commit/c59cb8e))
350
+
351
+ ## 0.2.4 (2025-02-17)
352
+
353
+ ### Miscellaneous
354
+
355
+ - **monorepo:** Reformat monorepo files
356
+ ([1db5e06](https://github.com/storm-software/stryke/commit/1db5e06))
357
+
358
+ ## 0.2.3 (2025-02-15)
359
+
360
+ ### Miscellaneous
361
+
362
+ - **monorepo:** Reformat monorepo files
363
+ ([69ed6b7](https://github.com/storm-software/stryke/commit/69ed6b7))
364
+
365
+ ## 0.2.2 (2025-02-15)
366
+
367
+ ### Bug Fixes
368
+
369
+ - **hash:** Resolve issue creating hash objects
370
+ ([e9045a9](https://github.com/storm-software/stryke/commit/e9045a9))
371
+
372
+ ## 0.2.1 (2025-02-15)
373
+
374
+ ### Miscellaneous
375
+
376
+ - **monorepo:** Reformat workspace files
377
+ ([ad2d6a9](https://github.com/storm-software/stryke/commit/ad2d6a9))
378
+
379
+ ## 0.2.0 (2025-02-12)
380
+
381
+ ### Features
382
+
383
+ - **monorepo:** Upgrade package manager and dependencies
384
+ ([a2e8a3b](https://github.com/storm-software/stryke/commit/a2e8a3b))
385
+
386
+ ## 0.1.1 (2025-02-12)
387
+
388
+ ### Bug Fixes
389
+
390
+ - **hash:** Resolve issue with invalid object hash
391
+ ([ac12109](https://github.com/storm-software/stryke/commit/ac12109))
package/README.md CHANGED
@@ -3,7 +3,13 @@
3
3
  <!-- markdownlint-disable -->
4
4
 
5
5
 
6
- <div align="center"><img src="https://public.storm-cdn.com/storm-banner.gif" width="100%" alt="Storm Software" /></div>
6
+ <div align="center">
7
+ <picture>
8
+ <source media="(prefers-color-scheme: dark)" srcset="https://public.storm-cdn.com/storm-software/banner-1280x640-dark-optimized.gif">
9
+ <source media="(prefers-color-scheme: light)" srcset="https://public.storm-cdn.com/storm-software/banner-1280x640-light-optimized.gif">
10
+ <img src="https://public.storm-cdn.com/storm-software/banner-1280x640-dark-optimized.gif" width="100%" alt="Storm Software" />
11
+ </picture>
12
+ </div>
7
13
  <br />
8
14
 
9
15
  <div align="center">
@@ -16,13 +22,13 @@
16
22
  </div>
17
23
 
18
24
  <br />
19
- This package is part of Storm Software's **🌩️ Stryke** monorepo. Stryke packages TypeScript utility packages with shared functionality common to many Storm Software applications.
25
+ This package is part of Storm Software's **💥 Stryke** monorepo. Stryke packages TypeScript utility packages with shared functionality common to many Storm Software applications.
20
26
 
21
27
  <br />
22
28
 
23
29
  <h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
24
30
 
25
- [![Version](https://img.shields.io/badge/version-0.9.6-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/stryke/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
31
+ [![Version](https://img.shields.io/badge/version-0.12.19-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/stryke/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
26
32
 
27
33
  > [!IMPORTANT] Important
28
34
  > This repository, and the apps, libraries, and tools contained within, is still in it's initial development phase. As a result, bugs and issues are expected with it's usage. When the main development phase completes, a proper release will be performed, the packages will be available through NPM (and other distributions), and this message will be removed. However, in the meantime, please feel free to report any issues you may come across.
@@ -92,10 +98,10 @@ yarn add -D @stryke/hash
92
98
 
93
99
  ## Reduced Package Size
94
100
 
95
- This project uses [tsup](https://tsup.egoist.dev/) to package the source code
96
- due to its ability to remove unused code and ship smaller javascript files
97
- thanks to code splitting. This helps to greatly reduce the size of the package
98
- and to make it easier to use in other projects.
101
+ This project uses [tsdown](https://tsdown.dev) to package the source code due to
102
+ its ability to remove unused code and ship smaller javascript files thanks to
103
+ code splitting. This helps to greatly reduce the size of the package and to make
104
+ it easier to use in other projects.
99
105
 
100
106
  ## Development
101
107
 
@@ -236,10 +242,13 @@ specification. Contributions of any kind welcome!
236
242
  <br />
237
243
 
238
244
  <hr />
239
- <br />
240
245
 
241
246
  <div align="center">
242
- <img src="https://public.storm-cdn.com/logo-banner.png" width="100%" alt="Storm Software" />
247
+ <picture>
248
+ <source media="(prefers-color-scheme: dark)" srcset="https://public.storm-cdn.com/storm-software/banner-1280x320-dark-optimized.webp">
249
+ <source media="(prefers-color-scheme: light)" srcset="https://public.storm-cdn.com/storm-software/banner-1280x320-light-optimized.webp">
250
+ <img src="https://public.storm-cdn.com/storm-software/banner-1280x320-dark-optimized.webp" width="100%" alt="Storm Software" />
251
+ </picture>
243
252
  </div>
244
253
  <br />
245
254
 
@@ -0,0 +1,2 @@
1
+ function e(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=t.byteLength;if(n<65535)return String.fromCharCode.apply(null,t);let r=``;for(let e=0;e<n;e++)r+=String.fromCharCode(t[e]);return r}function t(e){return Uint8Array.from([...encodeURIComponent(e)].map(e=>e.codePointAt(0)))}new TextEncoder,new TextDecoder;function n(e){return new a(e)}async function r(n,r=`SHA-512`){return e(await globalThis.crypto.subtle.digest(r,t(n)))}const i=r;var a=class{#e=[];#t;constructor(e){this.#t=e}update(e){this.#e.push(e)}async digest(){let e=new Uint8Array(this.#e.reduce((e,t)=>e+t.length,0)),t=0;for(let n of this.#e)e.set(n,t),t+=n.length;let n=await globalThis.crypto.subtle.digest(this.#t,e);return new Uint8Array(n)}};export{i,n,r,a as t};
2
+ //# sourceMappingURL=digest-311IQaur.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"digest-311IQaur.mjs","names":["#algorithm","#chunks"],"sources":["../../convert/src/array-buffer-to-string.ts","../../convert/src/string-to-uint8-array.ts","../../convert/src/string-to-utf8-array.ts","../../convert/src/utf8-array-to-string.ts","../src/digest.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * Convert an ArrayBuffer or Uint8Array to a string\n *\n * @param buffer - The ArrayBuffer or Uint8Array to convert\n * @returns The converted string\n */\nexport function arrayBufferToString(\n buffer: ArrayBuffer | ArrayBufferLike | Uint8Array\n): string {\n const bytes =\n buffer instanceof Uint8Array\n ? buffer\n : new Uint8Array(buffer as ArrayBufferLike);\n const len = bytes.byteLength;\n if (len < 65535) {\n return String.fromCharCode.apply(null, bytes as unknown as number[]);\n }\n let binary = \"\";\n for (let i = 0; i < len; i++) {\n binary += String.fromCharCode(bytes[i]!);\n }\n return binary;\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * Convert a string to Uint8Array\n *\n * @param text - The text to convert\n * @returns The converted Uint8Array\n */\nexport function stringToUint8Array(text: string): Uint8Array {\n return Uint8Array.from(\n [...encodeURIComponent(text)].map(letter => letter.codePointAt(0)!)\n );\n}\n\n/**\n * Convert a binary string to Uint8Array\n *\n * @param binary - The binary string to convert\n * @returns The converted Uint8Array\n */\nexport function binaryStringToUint8Array(binary: string): Uint8Array {\n const len = binary.length;\n const arr = new Uint8Array(len);\n for (let i = 0; i < len; i++) {\n arr[i] = binary.charCodeAt(i);\n }\n return arr;\n}\n\n/**\n * Convert a base64 string to a Uint8Array\n *\n * @param data - The base64 string to convert\n * @returns The converted Uint8Array\n */\nexport function base64StringToUint8Array(data: string): Uint8Array {\n return stringToUint8Array(atob(data));\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nconst encoder = new TextEncoder();\n\n/**\n * Convert a string to a utf-8 array\n *\n * @param input - The string to convert\n * @returns The converted utf-8 array\n */\nexport function stringToUtf8Array(input: string): Uint8Array {\n return encoder.encode(input);\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nconst decoder = new TextDecoder();\n\n/**\n * Convert a utf-8 array to string\n *\n * @param input - Utf-8 Array\n * @returns The converted string\n */\nexport function utf8ArrayToString(\n input: NodeJS.ArrayBufferView | ArrayBuffer\n): string {\n return decoder.decode(input);\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n arrayBufferToString,\n stringToUint8Array\n} from \"@stryke/convert/neutral\";\n\nexport type AlgorithmIdentifier = \"SHA-256\" | \"SHA-384\" | \"SHA-512\";\n\n/**\n * Creates a new hash object for the specified algorithm.\n *\n * @param algorithm - The algorithm to use for the hash.\n * @returns A new hash object.\n */\nexport function createHasher(algorithm: AlgorithmIdentifier): Hasher {\n return new Hasher(algorithm);\n}\n\n/**\n * Creates a new hash object for the specified algorithm.\n *\n * @remarks\n * This function uses the Web Crypto API to create a hash of the input data.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest\n *\n * @param data - The data to hash.\n * @param algorithm - The algorithm to use for the hash.\n * @returns A hash string representation of the `data` parameter.\n */\nexport async function digest(\n data: string,\n algorithm: AlgorithmIdentifier = \"SHA-512\"\n): Promise<string> {\n const arrayBuffer = await globalThis.crypto.subtle.digest(\n algorithm,\n stringToUint8Array(data) as BufferSource\n );\n\n return arrayBufferToString(arrayBuffer);\n}\n\nexport const hash = digest;\n\nexport class Hasher {\n #chunks: Uint8Array[] = [];\n\n #algorithm: AlgorithmIdentifier;\n\n constructor(algorithm: AlgorithmIdentifier) {\n this.#algorithm = algorithm;\n }\n\n update(data: Uint8Array): void {\n this.#chunks.push(data);\n }\n\n async digest(): Promise<Uint8Array> {\n const data = new Uint8Array(\n this.#chunks.reduce((acc, chunk) => acc + chunk.length, 0)\n );\n let offset = 0;\n for (const chunk of this.#chunks) {\n data.set(chunk, offset);\n offset += chunk.length;\n }\n const arrayBuffer = await globalThis.crypto.subtle.digest(\n this.#algorithm,\n data\n );\n\n return new Uint8Array(arrayBuffer);\n }\n}\n"],"mappings":"AAwBA,SAAgB,EACd,EACQ,CACR,IAAM,EACJ,aAAkB,WACd,EACA,IAAI,WAAW,EAA0B,CACzC,EAAM,EAAM,WAClB,GAAI,EAAM,MACR,OAAO,OAAO,aAAa,MAAM,KAAM,EAA6B,CAEtE,IAAI,EAAS,GACb,IAAK,IAAI,EAAI,EAAG,EAAI,EAAK,IACvB,GAAU,OAAO,aAAa,EAAM,GAAI,CAE1C,OAAO,ECfT,SAAgB,EAAmB,EAA0B,CAC3D,OAAO,WAAW,KAChB,CAAC,GAAG,mBAAmB,EAAK,CAAC,CAAC,IAAI,GAAU,EAAO,YAAY,EAAE,CAAE,CACpE,CCTa,IAAI,YCAJ,IAAI,YCapB,SAAgB,EAAa,EAAwC,CACnE,OAAO,IAAI,EAAO,EAAU,CAe9B,eAAsB,EACpB,EACA,EAAiC,UAChB,CAMjB,OAAO,EALa,MAAM,WAAW,OAAO,OAAO,OACjD,EACA,EAAmB,EAAK,CACzB,CAEsC,CAGzC,MAAa,EAAO,EAEpB,IAAa,EAAb,KAAoB,CAClB,GAAwB,EAAE,CAE1B,GAEA,YAAY,EAAgC,CAC1C,MAAA,EAAkB,EAGpB,OAAO,EAAwB,CAC7B,MAAA,EAAa,KAAK,EAAK,CAGzB,MAAM,QAA8B,CAClC,IAAM,EAAO,IAAI,WACf,MAAA,EAAa,QAAQ,EAAK,IAAU,EAAM,EAAM,OAAQ,EAAE,CAC3D,CACG,EAAS,EACb,IAAK,IAAM,KAAS,MAAA,EAClB,EAAK,IAAI,EAAO,EAAO,CACvB,GAAU,EAAM,OAElB,IAAM,EAAc,MAAM,WAAW,OAAO,OAAO,OACjD,MAAA,EACA,EACD,CAED,OAAO,IAAI,WAAW,EAAY"}
@@ -0,0 +1,32 @@
1
+ //#region src/digest.d.ts
2
+ type AlgorithmIdentifier = "SHA-256" | "SHA-384" | "SHA-512";
3
+ /**
4
+ * Creates a new hash object for the specified algorithm.
5
+ *
6
+ * @param algorithm - The algorithm to use for the hash.
7
+ * @returns A new hash object.
8
+ */
9
+ declare function createHasher(algorithm: AlgorithmIdentifier): Hasher;
10
+ /**
11
+ * Creates a new hash object for the specified algorithm.
12
+ *
13
+ * @remarks
14
+ * This function uses the Web Crypto API to create a hash of the input data.
15
+ *
16
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest
17
+ *
18
+ * @param data - The data to hash.
19
+ * @param algorithm - The algorithm to use for the hash.
20
+ * @returns A hash string representation of the `data` parameter.
21
+ */
22
+ declare function digest(data: string, algorithm?: AlgorithmIdentifier): Promise<string>;
23
+ declare const hash: typeof digest;
24
+ declare class Hasher {
25
+ #private;
26
+ constructor(algorithm: AlgorithmIdentifier);
27
+ update(data: Uint8Array): void;
28
+ digest(): Promise<Uint8Array>;
29
+ }
30
+ //#endregion
31
+ export { hash as a, digest as i, Hasher as n, createHasher as r, AlgorithmIdentifier as t };
32
+ //# sourceMappingURL=digest-CG1Sk96A.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"digest-CG1Sk96A.d.mts","names":[],"sources":["../src/digest.ts"],"sourcesContent":[],"mappings":";KAuBY,mBAAA;AAAZ;AAQA;AAgBA;AAYA;AAEA;;AASe,iBAvCC,YAAA,CAuCD,SAAA,EAvCyB,mBAuCzB,CAAA,EAvC+C,MAuC/C;;;;;;;;;;;;;iBAvBO,MAAA,2BAET,sBACV;cASU,aAAI;cAEJ,MAAA;;yBAKY;eAIV;YAIG,QAAQ"}
@@ -0,0 +1 @@
1
+ function e(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=t.byteLength;if(n<65535)return String.fromCharCode.apply(null,t);let r=``;for(let e=0;e<n;e++)r+=String.fromCharCode(t[e]);return r}function t(e){return Uint8Array.from([...encodeURIComponent(e)].map(e=>e.codePointAt(0)))}const n=new TextEncoder,r=new TextDecoder;function i(e){return new s(e)}async function a(n,r=`SHA-512`){return e(await globalThis.crypto.subtle.digest(r,t(n)))}const o=a;var s=class{#e=[];#t;constructor(e){this.#t=e}update(e){this.#e.push(e)}async digest(){let e=new Uint8Array(this.#e.reduce((e,t)=>e+t.length,0)),t=0;for(let n of this.#e)e.set(n,t),t+=n.length;let n=await globalThis.crypto.subtle.digest(this.#t,e);return new Uint8Array(n)}};Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return s}});
@@ -0,0 +1,32 @@
1
+ //#region src/digest.d.ts
2
+ type AlgorithmIdentifier = "SHA-256" | "SHA-384" | "SHA-512";
3
+ /**
4
+ * Creates a new hash object for the specified algorithm.
5
+ *
6
+ * @param algorithm - The algorithm to use for the hash.
7
+ * @returns A new hash object.
8
+ */
9
+ declare function createHasher(algorithm: AlgorithmIdentifier): Hasher;
10
+ /**
11
+ * Creates a new hash object for the specified algorithm.
12
+ *
13
+ * @remarks
14
+ * This function uses the Web Crypto API to create a hash of the input data.
15
+ *
16
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest
17
+ *
18
+ * @param data - The data to hash.
19
+ * @param algorithm - The algorithm to use for the hash.
20
+ * @returns A hash string representation of the `data` parameter.
21
+ */
22
+ declare function digest(data: string, algorithm?: AlgorithmIdentifier): Promise<string>;
23
+ declare const hash: typeof digest;
24
+ declare class Hasher {
25
+ #private;
26
+ constructor(algorithm: AlgorithmIdentifier);
27
+ update(data: Uint8Array): void;
28
+ digest(): Promise<Uint8Array>;
29
+ }
30
+ //#endregion
31
+ export { hash as a, digest as i, Hasher as n, createHasher as r, AlgorithmIdentifier as t };
32
+ //# sourceMappingURL=digest-Yy26O9oW.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"digest-Yy26O9oW.d.cts","names":[],"sources":["../src/digest.ts"],"sourcesContent":[],"mappings":";KAuBY,mBAAA;AAAZ;AAQA;AAgBA;AAYA;AAEA;;AASe,iBAvCC,YAAA,CAuCD,SAAA,EAvCyB,mBAuCzB,CAAA,EAvC+C,MAuC/C;;;;;;;;;;;;;iBAvBO,MAAA,2BAET,sBACV;cASU,aAAI;cAEJ,MAAA;;yBAKY;eAIV;YAIG,QAAQ"}
package/dist/digest.cjs CHANGED
@@ -1,36 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Hasher = void 0;
7
- exports.createHasher = createHasher;
8
- exports.digest = digest;
9
- exports.hash = void 0;
10
- var _neutral = require("@stryke/convert/neutral");
11
- function createHasher(r) {
12
- return new Hasher(r);
13
- }
14
- async function digest(r, t = "SHA-512") {
15
- const e = await globalThis.crypto.subtle.digest(t, (0, _neutral.stringToUint8Array)(r));
16
- return (0, _neutral.arrayBufferToString)(e);
17
- }
18
- const hash = exports.hash = digest;
19
- class Hasher {
20
- #t = [];
21
- #r;
22
- constructor(t) {
23
- this.#r = t;
24
- }
25
- update(t) {
26
- this.#t.push(t);
27
- }
28
- async digest() {
29
- const t = new Uint8Array(this.#t.reduce((i, s) => i + s.length, 0));
30
- let e = 0;
31
- for (const i of this.#t) t.set(i, e), e += i.length;
32
- const n = await globalThis.crypto.subtle.digest(this.#r, t);
33
- return new Uint8Array(n);
34
- }
35
- }
36
- exports.Hasher = Hasher;
1
+ const e=require(`./digest-REorjd4v.cjs`);require(`./src-QUlAu3to.cjs`),exports.Hasher=e.t,exports.createHasher=e.n,exports.digest=e.r,exports.hash=e.i;
@@ -0,0 +1,2 @@
1
+ import { a as hash, i as digest, n as Hasher, r as createHasher, t as AlgorithmIdentifier } from "./digest-Yy26O9oW.cjs";
2
+ export { AlgorithmIdentifier, Hasher, createHasher, digest, hash };
@@ -0,0 +1,2 @@
1
+ import { a as hash, i as digest, n as Hasher, r as createHasher, t as AlgorithmIdentifier } from "./digest-CG1Sk96A.mjs";
2
+ export { AlgorithmIdentifier, Hasher, createHasher, digest, hash };
package/dist/digest.mjs CHANGED
@@ -1 +1 @@
1
- import{arrayBufferToString as o,stringToUint8Array as a}from"@stryke/convert/neutral";export function createHasher(r){return new Hasher(r)}export async function digest(r,t="SHA-512"){const e=await globalThis.crypto.subtle.digest(t,a(r));return o(e)}export const hash=digest;export class Hasher{#t=[];#r;constructor(t){this.#r=t}update(t){this.#t.push(t)}async digest(){const t=new Uint8Array(this.#t.reduce((i,s)=>i+s.length,0));let e=0;for(const i of this.#t)t.set(i,e),e+=i.length;const n=await globalThis.crypto.subtle.digest(this.#r,t);return new Uint8Array(n)}}
1
+ import{i as e,n as t,r as n,t as r}from"./digest-311IQaur.mjs";import"./src-GI5wB-mz.mjs";export{r as Hasher,t as createHasher,n as digest,e as hash};
@@ -1,3 +1,4 @@
1
+ //#region src/etag.d.ts
1
2
  /**
2
3
  * FNV-1a Hash implementation
3
4
  *
@@ -7,7 +8,7 @@
7
8
  * Simplified, optimized and add modified for 52 bit, which provides a larger hash space
8
9
  * and still making use of Javascript's 53-bit integer space.
9
10
  */
10
- export declare const fnv1a52: (str: string) => number;
11
+ declare const fnv1a52: (str: string) => number;
11
12
  /**
12
13
  * Generates an ETag for the given payload.
13
14
  *
@@ -15,4 +16,7 @@ export declare const fnv1a52: (str: string) => number;
15
16
  * @param weak - Whether to generate a weak ETag.
16
17
  * @returns The generated ETag.
17
18
  */
18
- export declare const generateETag: (payload: string, weak?: boolean) => string;
19
+ declare const generateETag: (payload: string, weak?: boolean) => string;
20
+ //#endregion
21
+ export { generateETag as n, fnv1a52 as t };
22
+ //# sourceMappingURL=etag-BdoEX_I_.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"etag-BdoEX_I_.d.cts","names":[],"sources":["../src/etag.ts"],"sourcesContent":[],"mappings":";;AA2BA;AA2CA;;;;;;;cA3Ca;;;;;;;;cA2CA"}
@@ -0,0 +1,2 @@
1
+ const e=e=>{let t=e.length,n=0,r=0,i=8997,a=0,o=33826,s=0,c=40164,l=0,u=52210;for(;n<t;)i^=e.charCodeAt(n++),r=i*435,a=o*435,s=c*435,l=u*435,s+=i<<8,l+=o<<8,a+=r>>>16,i=r&65535,s+=a>>>16,o=a&65535,u=l+(s>>>16)&65535,c=s&65535;return(u&15)*281474976710656+c*4294967296+o*65536+(i^u>>4)},t=(t,n=!1)=>`${(n?`W/"`:`"`)+e(t).toString(36)+t.length.toString(36)}"`;export{t as n,e as t};
2
+ //# sourceMappingURL=etag-DXmoR6hr.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"etag-DXmoR6hr.mjs","names":[],"sources":["../src/etag.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * FNV-1a Hash implementation\n *\n * Ported from https://github.com/tjwebb/fnv-plus/blob/master/index.js\n *\n * @remarks\n * Simplified, optimized and add modified for 52 bit, which provides a larger hash space\n * and still making use of Javascript's 53-bit integer space.\n */\nexport const fnv1a52 = (str: string) => {\n const len = str.length;\n let i = 0;\n let t0 = 0;\n let v0 = 0x2325;\n let t1 = 0;\n let v1 = 0x8422;\n let t2 = 0;\n let v2 = 0x9ce4;\n let t3 = 0;\n let v3 = 0xcbf2;\n\n while (i < len) {\n v0 ^= str.charCodeAt(i++);\n t0 = v0 * 435;\n t1 = v1 * 435;\n t2 = v2 * 435;\n t3 = v3 * 435;\n t2 += v0 << 8;\n t3 += v1 << 8;\n t1 += t0 >>> 16;\n v0 = t0 & 65535;\n t2 += t1 >>> 16;\n v1 = t1 & 65535;\n v3 = (t3 + (t2 >>> 16)) & 65535;\n v2 = t2 & 65535;\n }\n\n return (\n (v3 & 15) * 281474976710656 +\n v2 * 4294967296 +\n v1 * 65536 +\n (v0 ^ (v3 >> 4))\n );\n};\n\n/**\n * Generates an ETag for the given payload.\n *\n * @param payload - The payload to generate an ETag for.\n * @param weak - Whether to generate a weak ETag.\n * @returns The generated ETag.\n */\nexport const generateETag = (payload: string, weak = false) => {\n const prefix = weak ? 'W/\"' : '\"';\n\n return `${prefix + fnv1a52(payload).toString(36) + payload.length.toString(36)}\"`;\n};\n"],"mappings":"AA2BA,MAAa,EAAW,GAAgB,CACtC,IAAM,EAAM,EAAI,OACZ,EAAI,EACJ,EAAK,EACL,EAAK,KACL,EAAK,EACL,EAAK,MACL,EAAK,EACL,EAAK,MACL,EAAK,EACL,EAAK,MAET,KAAO,EAAI,GACT,GAAM,EAAI,WAAW,IAAI,CACzB,EAAK,EAAK,IACV,EAAK,EAAK,IACV,EAAK,EAAK,IACV,EAAK,EAAK,IACV,GAAM,GAAM,EACZ,GAAM,GAAM,EACZ,GAAM,IAAO,GACb,EAAK,EAAK,MACV,GAAM,IAAO,GACb,EAAK,EAAK,MACV,EAAM,GAAM,IAAO,IAAO,MAC1B,EAAK,EAAK,MAGZ,OACG,EAAK,IAAM,gBACZ,EAAK,WACL,EAAK,OACJ,EAAM,GAAM,IAWJ,GAAgB,EAAiB,EAAO,KAG5C,IAFQ,EAAO,MAAQ,KAEX,EAAQ,EAAQ,CAAC,SAAS,GAAG,CAAG,EAAQ,OAAO,SAAS,GAAG,CAAC"}