GeezerVison is showing github.com — doc: mention crypto.hash() for better perf · nodejs/node@c879f91
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: doc/api/crypto.md +3Lines changed: 3 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -3773,6 +3773,8 @@ using the given `algorithm`. Optional `options` argument controls stream |
3773 | 3773 | behavior. For XOF hash functions such as `'shake256'`, the `outputLength` option |
3774 | 3774 | can be used to specify the desired output length in bytes. |
3775 | 3775 |
|
| 3776 | +When the data is small (< 5MB) and readily available, [`crypto.hash()`][] is usually faster. |
| 3777 | + |
3776 | 3778 | The `algorithm` is dependent on the available algorithms supported by the |
3777 | 3779 | version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. |
3778 | 3780 | On recent releases of OpenSSL, `openssl list -digest-algorithms` will |
@@ -6925,6 +6927,7 @@ See the [list of SSL OP Flags][] for details. |
6925 | 6927 | [`crypto.getCurves()`]: #cryptogetcurves |
6926 | 6928 | [`crypto.getDiffieHellman()`]: #cryptogetdiffiehellmangroupname |
6927 | 6929 | [`crypto.getHashes()`]: #cryptogethashes |
| 6930 | +[`crypto.hash()`]: #cryptohashalgorithm-data-options |
6928 | 6931 | [`crypto.privateDecrypt()`]: #cryptoprivatedecryptprivatekey-buffer |
6929 | 6932 | [`crypto.privateEncrypt()`]: #cryptoprivateencryptprivatekey-buffer |
6930 | 6933 | [`crypto.publicDecrypt()`]: #cryptopublicdecryptkey-buffer |
|