From 05c7389b32f0df85990edb20297d8bf0ed3eac85 Mon Sep 17 00:00:00 2001 From: Steven Date: Mon, 18 May 2026 21:18:39 -0400 Subject: [PATCH 1/2] doc: mention crypto.hash() for better perf Signed-off-by: Steven --- doc/api/crypto.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/api/crypto.md b/doc/api/crypto.md index 91cb32a1b9816f..fbeff15b77c4a9 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -3773,6 +3773,8 @@ using the given `algorithm`. Optional `options` argument controls stream behavior. For XOF hash functions such as `'shake256'`, the `outputLength` option can be used to specify the desired output length in bytes. +For a smaller data (< 5MB), use [`crypto.hash()`][] instead for better performance. + The `algorithm` is dependent on the available algorithms supported by the version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. On recent releases of OpenSSL, `openssl list -digest-algorithms` will @@ -6935,6 +6937,7 @@ See the [list of SSL OP Flags][] for details. [`crypto.getCurves()`]: #cryptogetcurves [`crypto.getDiffieHellman()`]: #cryptogetdiffiehellmangroupname [`crypto.getHashes()`]: #cryptogethashes +[`crypto.hash()`]: #cryptohashalgorithm-data-options [`crypto.privateDecrypt()`]: #cryptoprivatedecryptprivatekey-buffer [`crypto.privateEncrypt()`]: #cryptoprivateencryptprivatekey-buffer [`crypto.publicDecrypt()`]: #cryptopublicdecryptkey-buffer From 22762d35dee92f9b625534b2449f107256ad94fe Mon Sep 17 00:00:00 2001 From: Steven Date: Wed, 20 May 2026 11:06:00 -0400 Subject: [PATCH 2/2] doc: apply suggestion from joyeecheung Co-authored-by: Joyee Cheung --- doc/api/crypto.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/crypto.md b/doc/api/crypto.md index fbeff15b77c4a9..b4be4e2d51bdcf 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -3773,7 +3773,7 @@ using the given `algorithm`. Optional `options` argument controls stream behavior. For XOF hash functions such as `'shake256'`, the `outputLength` option can be used to specify the desired output length in bytes. -For a smaller data (< 5MB), use [`crypto.hash()`][] instead for better performance. +When the data is small (< 5MB) and readily available, [`crypto.hash()`][] is usually faster. The `algorithm` is dependent on the available algorithms supported by the version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc.