| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent a002974 commit ccd756d
14 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,6 +2,10 @@ | |||
| 2 | 2 | ||
| 3 | 3 | <!-- YAML | |
| 4 | 4 | changes: | |
| 5 | + - version: REPLACEME | ||
| 6 | + pr-url: https://github.com/nodejs/node/pull/62183 | ||
| 7 | + description: TurboSHAKE and KangarooTwelve algorithms | ||
| 8 | + are now supported. | ||
| 5 | 9 | - version: v24.8.0 | |
| 6 | 10 | pr-url: https://github.com/nodejs/node/pull/59647 | |
| 7 | 11 | description: KMAC algorithms are now supported. | |
@@ -121,6 +125,8 @@ Algorithms: | |||
| 121 | 125 | * `'cSHAKE256'` | |
| 122 | 126 | * `'KMAC128'`[^openssl30] | |
| 123 | 127 | * `'KMAC256'`[^openssl30] | |
| 128 | + * `'KT128'` | ||
| 129 | + * `'KT256'` | ||
| 124 | 130 | * `'ML-DSA-44'`[^openssl35] | |
| 125 | 131 | * `'ML-DSA-65'`[^openssl35] | |
| 126 | 132 | * `'ML-DSA-87'`[^openssl35] | |
@@ -130,6 +136,8 @@ Algorithms: | |||
| 130 | 136 | * `'SHA3-256'` | |
| 131 | 137 | * `'SHA3-384'` | |
| 132 | 138 | * `'SHA3-512'` | |
| 139 | + * `'TurboSHAKE128'` | ||
| 140 | + * `'TurboSHAKE256'` | ||
| 133 | 141 | ||
| 134 | 142 | Key Formats: | |
| 135 | 143 | ||
@@ -574,6 +582,8 @@ Crypto API implementation and the APIs supported for each: | |||
| 574 | 582 | | `'HMAC'` | | ✔ | | | | | | |
| 575 | 583 | | `'KMAC128'`[^modern-algos] | | ✔ | | | | | | |
| 576 | 584 | | `'KMAC256'`[^modern-algos] | | ✔ | | | | | | |
| 585 | + | `'KT128'`[^modern-algos] | | | | | | ✔ | | ||
| 586 | + | `'KT256'`[^modern-algos] | | | | | | ✔ | | ||
| 577 | 587 | | `'ML-DSA-44'`[^modern-algos] | | ✔ | | | | | | |
| 578 | 588 | | `'ML-DSA-65'`[^modern-algos] | | ✔ | | | | | | |
| 579 | 589 | | `'ML-DSA-87'`[^modern-algos] | | ✔ | | | | | | |
@@ -591,6 +601,8 @@ Crypto API implementation and the APIs supported for each: | |||
| 591 | 601 | | `'SHA3-256'`[^modern-algos] | | | | | | ✔ | | |
| 592 | 602 | | `'SHA3-384'`[^modern-algos] | | | | | | ✔ | | |
| 593 | 603 | | `'SHA3-512'`[^modern-algos] | | | | | | ✔ | | |
| 604 | + | `'TurboSHAKE128'`[^modern-algos] | | | | | | ✔ | | ||
| 605 | + | `'TurboSHAKE256'`[^modern-algos] | | | | | | ✔ | | ||
| 594 | 606 | | `'X25519'` | | | ✔ | | | | | |
| 595 | 607 | | `'X448'`[^secure-curves] | | | ✔ | | | | | |
| 596 | 608 | ||
@@ -998,6 +1010,10 @@ The algorithms currently supported include: | |||
| 998 | 1010 | <!-- YAML | |
| 999 | 1011 | added: v15.0.0 | |
| 1000 | 1012 | changes: | |
| 1013 | + - version: REPLACEME | ||
| 1014 | + pr-url: https://github.com/nodejs/node/pull/62183 | ||
| 1015 | + description: TurboSHAKE and KangarooTwelve algorithms | ||
| 1016 | + are now supported. | ||
| 1001 | 1017 | - version: v24.7.0 | |
| 1002 | 1018 | pr-url: https://github.com/nodejs/node/pull/59365 | |
| 1003 | 1019 | description: SHA-3 algorithms are now supported. | |
@@ -1006,7 +1022,7 @@ changes: | |||
| 1006 | 1022 | description: SHAKE algorithms are now supported. | |
| 1007 | 1023 | --> | |
| 1008 | 1024 | ||
| 1009 | - * `algorithm` {string|Algorithm|CShakeParams} | ||
| 1025 | + * `algorithm` {string|Algorithm|CShakeParams|TurboShakeParams|KangarooTwelveParams} | ||
| 1010 | 1026 | * `data` {ArrayBuffer|TypedArray|DataView|Buffer} | |
| 1011 | 1027 | * Returns: {Promise} Fulfills with an {ArrayBuffer} upon success. | |
| 1012 | 1028 | ||
@@ -1018,13 +1034,17 @@ If `algorithm` is provided as a {string}, it must be one of: | |||
| 1018 | 1034 | ||
| 1019 | 1035 | * `'cSHAKE128'`[^modern-algos] | |
| 1020 | 1036 | * `'cSHAKE256'`[^modern-algos] | |
| 1037 | + * `'KT128'`[^modern-algos] | ||
| 1038 | + * `'KT256'`[^modern-algos] | ||
| 1021 | 1039 | * `'SHA-1'` | |
| 1022 | 1040 | * `'SHA-256'` | |
| 1023 | 1041 | * `'SHA-384'` | |
| 1024 | 1042 | * `'SHA-512'` | |
| 1025 | 1043 | * `'SHA3-256'`[^modern-algos] | |
| 1026 | 1044 | * `'SHA3-384'`[^modern-algos] | |
| 1027 | 1045 | * `'SHA3-512'`[^modern-algos] | |
| 1046 | + * `'TurboSHAKE128'`[^modern-algos] | ||
| 1047 | + * `'TurboSHAKE256'`[^modern-algos] | ||
| 1028 | 1048 | ||
| 1029 | 1049 | If `algorithm` is provided as an {Object}, it must have a `name` property | |
| 1030 | 1050 | whose value is one of the above. | |
@@ -2315,6 +2335,38 @@ added: v15.0.0 | |||
| 2315 | 2335 | ||
| 2316 | 2336 | * Type: {string} | |
| 2317 | 2337 | ||
| 2338 | + ### Class: `KangarooTwelveParams` | ||
| 2339 | + | ||
| 2340 | + <!-- YAML | ||
| 2341 | + added: REPLACEME | ||
| 2342 | + --> | ||
| 2343 | + | ||
| 2344 | + #### `kangarooTwelveParams.customization` | ||
| 2345 | + | ||
| 2346 | + <!-- YAML | ||
| 2347 | + added: REPLACEME | ||
| 2348 | + --> | ||
| 2349 | + | ||
| 2350 | + * Type: {ArrayBuffer|TypedArray|DataView|Buffer|undefined} | ||
| 2351 | + | ||
| 2352 | + The optional customization string for KangarooTwelve. | ||
| 2353 | + | ||
| 2354 | + #### `kangarooTwelveParams.name` | ||
| 2355 | + | ||
| 2356 | + <!-- YAML | ||
| 2357 | + added: REPLACEME | ||
| 2358 | + --> | ||
| 2359 | + | ||
| 2360 | + * Type: {string} Must be `'KT128'`[^modern-algos] or `'KT256'`[^modern-algos] | ||
| 2361 | + | ||
| 2362 | + #### `kangarooTwelveParams.outputLength` | ||
| 2363 | + | ||
| 2364 | + <!-- YAML | ||
| 2365 | + added: REPLACEME | ||
| 2366 | + --> | ||
| 2367 | + | ||
| 2368 | + * Type: {number} represents the requested output length in bits. | ||
| 2369 | + | ||
| 2318 | 2370 | ### Class: `KmacImportParams` | |
| 2319 | 2371 | ||
| 2320 | 2372 | <!-- YAML | |
@@ -2685,6 +2737,38 @@ added: v15.0.0 | |||
| 2685 | 2737 | ||
| 2686 | 2738 | The length (in bytes) of the random salt to use. | |
| 2687 | 2739 | ||
| 2740 | + ### Class: `TurboShakeParams` | ||
| 2741 | + | ||
| 2742 | + <!-- YAML | ||
| 2743 | + added: REPLACEME | ||
| 2744 | + --> | ||
| 2745 | + | ||
| 2746 | + #### `turboShakeParams.domainSeparation` | ||
| 2747 | + | ||
| 2748 | + <!-- YAML | ||
| 2749 | + added: REPLACEME | ||
| 2750 | + --> | ||
| 2751 | + | ||
| 2752 | + * Type: {number|undefined} | ||
| 2753 | + | ||
| 2754 | + The optional domain separation byte (0x01-0x7f). Defaults to `0x1f`. | ||
| 2755 | + | ||
| 2756 | + #### `turboShakeParams.name` | ||
| 2757 | + | ||
| 2758 | + <!-- YAML | ||
| 2759 | + added: REPLACEME | ||
| 2760 | + --> | ||
| 2761 | + | ||
| 2762 | + * Type: {string} Must be `'TurboSHAKE128'`[^modern-algos] or `'TurboSHAKE256'`[^modern-algos] | ||
| 2763 | + | ||
| 2764 | + #### `turboShakeParams.outputLength` | ||
| 2765 | + | ||
| 2766 | + <!-- YAML | ||
| 2767 | + added: REPLACEME | ||
| 2768 | + --> | ||
| 2769 | + | ||
| 2770 | + * Type: {number} represents the requested output length in bits. | ||
| 2771 | + | ||
| 2688 | 2772 | [^secure-curves]: See [Secure Curves in the Web Cryptography API][] | |
| 2689 | 2773 | ||
| 2690 | 2774 | [^modern-algos]: See [Modern Algorithms in the Web Cryptography API][] | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -14,6 +14,8 @@ const { | |||
| 14 | 14 | Hmac: _Hmac, | |
| 15 | 15 | kCryptoJobAsync, | |
| 16 | 16 | oneShotDigest, | |
| 17 | + TurboShakeJob, | ||
| 18 | + KangarooTwelveJob, | ||
| 17 | 19 | } = internalBinding('crypto'); | |
| 18 | 20 | ||
| 19 | 21 | const { | |
@@ -226,6 +228,24 @@ async function asyncDigest(algorithm, data) { | |||
| 226 | 228 | normalizeHashName(algorithm.name), | |
| 227 | 229 | data, | |
| 228 | 230 | algorithm.outputLength)); | |
| 231 | + case 'TurboSHAKE128': | ||
| 232 | + // Fall through | ||
| 233 | + case 'TurboSHAKE256': | ||
| 234 | + return await jobPromise(() => new TurboShakeJob( | ||
| 235 | + kCryptoJobAsync, | ||
| 236 | + algorithm.name, | ||
| 237 | + algorithm.domainSeparation ?? 0x1f, | ||
| 238 | + algorithm.outputLength / 8, | ||
| 239 | + data)); | ||
| 240 | + case 'KT128': | ||
| 241 | + // Fall through | ||
| 242 | + case 'KT256': | ||
| 243 | + return await jobPromise(() => new KangarooTwelveJob( | ||
| 244 | + kCryptoJobAsync, | ||
| 245 | + algorithm.name, | ||
| 246 | + algorithm.customization, | ||
| 247 | + algorithm.outputLength / 8, | ||
| 248 | + data)); | ||
| 229 | 249 | } | |
| 230 | 250 | ||
| 231 | 251 | throw lazyDOMException('Unrecognized algorithm name', 'NotSupportedError'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -246,6 +246,10 @@ const kAlgorithmDefinitions = { | |||
| 246 | 246 | }, | |
| 247 | 247 | 'cSHAKE128': { 'digest': 'CShakeParams' }, | |
| 248 | 248 | 'cSHAKE256': { 'digest': 'CShakeParams' }, | |
| 249 | + 'KT128': { 'digest': 'KangarooTwelveParams' }, | ||
| 250 | + 'KT256': { 'digest': 'KangarooTwelveParams' }, | ||
| 251 | + 'TurboSHAKE128': { 'digest': 'TurboShakeParams' }, | ||
| 252 | + 'TurboSHAKE256': { 'digest': 'TurboShakeParams' }, | ||
| 249 | 253 | 'ECDH': { | |
| 250 | 254 | 'generateKey': 'EcKeyGenParams', | |
| 251 | 255 | 'exportKey': null, | |
@@ -443,6 +447,10 @@ const experimentalAlgorithms = [ | |||
| 443 | 447 | 'SHA3-256', | |
| 444 | 448 | 'SHA3-384', | |
| 445 | 449 | 'SHA3-512', | |
| 450 | + 'TurboSHAKE128', | ||
| 451 | + 'TurboSHAKE256', | ||
| 452 | + 'KT128', | ||
| 453 | + 'KT256', | ||
| 446 | 454 | 'X448', | |
| 447 | 455 | ]; | |
| 448 | 456 | ||
@@ -515,6 +523,10 @@ const simpleAlgorithmDictionaries = { | |||
| 515 | 523 | KmacParams: { | |
| 516 | 524 | customization: 'BufferSource', | |
| 517 | 525 | }, | |
| 526 | + KangarooTwelveParams: { | ||
| 527 | + customization: 'BufferSource', | ||
| 528 | + }, | ||
| 529 | + TurboShakeParams: {}, | ||
| 518 | 530 | }; | |
| 519 | 531 | ||
| 520 | 532 | function validateMaxBufferLength(data, name) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -877,6 +877,52 @@ converters.KmacParams = createDictionaryConverter( | |||
| 877 | 877 | }, | |
| 878 | 878 | ]); | |
| 879 | 879 | ||
| 880 | + converters.KangarooTwelveParams = createDictionaryConverter( | ||
| 881 | + 'KangarooTwelveParams', [ | ||
| 882 | + ...new SafeArrayIterator(dictAlgorithm), | ||
| 883 | + { | ||
| 884 | + key: 'outputLength', | ||
| 885 | + converter: (V, opts) => | ||
| 886 | + converters['unsigned long'](V, { ...opts, enforceRange: true }), | ||
| 887 | + validator: (V, opts) => { | ||
| 888 | + if (V === 0 || V % 8) | ||
| 889 | + throw lazyDOMException('Invalid KangarooTwelveParams outputLength', 'OperationError'); | ||
| 890 | + }, | ||
| 891 | + required: true, | ||
| 892 | + }, | ||
| 893 | + { | ||
| 894 | + key: 'customization', | ||
| 895 | + converter: converters.BufferSource, | ||
| 896 | + }, | ||
| 897 | + ]); | ||
| 898 | + | ||
| 899 | + converters.TurboShakeParams = createDictionaryConverter( | ||
| 900 | + 'TurboShakeParams', [ | ||
| 901 | + ...new SafeArrayIterator(dictAlgorithm), | ||
| 902 | + { | ||
| 903 | + key: 'outputLength', | ||
| 904 | + converter: (V, opts) => | ||
| 905 | + converters['unsigned long'](V, { ...opts, enforceRange: true }), | ||
| 906 | + validator: (V, opts) => { | ||
| 907 | + if (V === 0 || V % 8) | ||
| 908 | + throw lazyDOMException('Invalid TurboShakeParams outputLength', 'OperationError'); | ||
| 909 | + }, | ||
| 910 | + required: true, | ||
| 911 | + }, | ||
| 912 | + { | ||
| 913 | + key: 'domainSeparation', | ||
| 914 | + converter: (V, opts) => | ||
| 915 | + converters.octet(V, { ...opts, enforceRange: true }), | ||
| 916 | + validator: (V) => { | ||
| 917 | + if (V < 0x01 || V > 0x7F) { | ||
| 918 | + throw lazyDOMException( | ||
| 919 | + 'TurboShakeParams.domainSeparation must be in range 0x01-0x7f', | ||
| 920 | + 'OperationError'); | ||
| 921 | + } | ||
| 922 | + }, | ||
| 923 | + }, | ||
| 924 | + ]); | ||
| 925 | + | ||
| 880 | 926 | module.exports = { | |
| 881 | 927 | converters, | |
| 882 | 928 | requiredArguments, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -388,6 +388,7 @@ | |||
| 388 | 388 | 'src/crypto/crypto_kem.cc', | |
| 389 | 389 | 'src/crypto/crypto_hmac.cc', | |
| 390 | 390 | 'src/crypto/crypto_kmac.cc', | |
| 391 | + 'src/crypto/crypto_turboshake.cc', | ||
| 391 | 392 | 'src/crypto/crypto_random.cc', | |
| 392 | 393 | 'src/crypto/crypto_rsa.cc', | |
| 393 | 394 | 'src/crypto/crypto_spkac.cc', | |
@@ -406,6 +407,7 @@ | |||
| 406 | 407 | 'src/crypto/crypto_dh.h', | |
| 407 | 408 | 'src/crypto/crypto_hmac.h', | |
| 408 | 409 | 'src/crypto/crypto_kmac.h', | |
| 410 | + 'src/crypto/crypto_turboshake.h', | ||
| 409 | 411 | 'src/crypto/crypto_rsa.h', | |
| 410 | 412 | 'src/crypto/crypto_spkac.h', | |
| 411 | 413 | 'src/crypto/crypto_util.h', | |
| Back | FazBrowse Home | New Git URL |
0 commit comments