I'd like to know if there is a way (API method for example) to know all available hash algorithms (and the exact input name) in NodeJs crypto module.
According to official docs, in createHash function it is said:
https://nodejs.org/api/crypto.html#crypto_crypto_createhash_algorithm_options
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 (openssl list-message-digest-algorithms for older versions of OpenSSL) will display the available digest algorithms.
So depending the OpenSSL version in the node version I am running, I will have different hash algorithm options? Any way(like API method) to know available hash algorithms in the installed crypto module directly?
Thanks
Node's crypto
has an api for getHashes()
according to their documentation.
Sample list
let crypto = require('crypto');
let listOfSupportedHashes = crypto.getHashes();
console.log('Total supported hashes : ', listOfSupportedHashes.length);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With