crypto.getCurves()

crypto.getCurves() Returns an array with the names of the supported elliptic curves. Example: const curves = crypto.getCurves(); console.log(curves); // ['secp256k1', 'secp384r1', ...]

crypto.getHashes()

crypto.getHashes() Returns an array with the names of the supported hash algorithms. Example: const hashes = crypto.getHashes(); console.log(hashes); // ['sha', 'sha1', 'sha1WithRSAEncryption', ...]

crypto.getCiphers()

crypto.getCiphers() Returns an array with the names of the supported cipher algorithms. Example: const ciphers = crypto.getCiphers(); console.log(ciphers); // ['aes-128-cbc', 'aes-128-ccm', ...]

crypto.createHmac()

crypto.createHmac(algorithm, key) Creates and returns an Hmac object that uses the given algorithm and key. 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-message-digest-algorithms will display the available digest algorithms. The key is the HMAC key used to generate the cryptographic HMAC hash. Example: generating the sha256 HMAC of a file const fil

crypto.createVerify()

crypto.createVerify(algorithm) Creates and returns a Verify object that uses the given algorithm. On recent OpenSSL releases, openssl list-public-key-algorithms will display the available signing algorithms. One example is 'RSA-SHA256'.

crypto.DEFAULT_ENCODING

crypto.DEFAULT_ENCODING The default encoding to use for functions that can take either strings or buffers. The default value is 'buffer', which makes methods default to Buffer objects. The crypto.DEFAULT_ENCODING mechanism is provided for backwards compatibility with legacy programs that expect 'binary' to be the default encoding. New applications should expect the default to be 'buffer'. This property may become deprecated in a future Node.js release.

crypto.createSign()

crypto.createSign(algorithm) Creates and returns a Sign object that uses the given algorithm. On recent OpenSSL releases, openssl list-public-key-algorithms will display the available signing algorithms. One example is 'RSA-SHA256'.

crypto.createHash()

crypto.createHash(algorithm) Creates and returns a Hash object that can be used to generate hash digests using the given algorithm. 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-message-digest-algorithms will display the available digest algorithms. Example: generating the sha256 sum of a file const filename = process.argv[2]; const crypto = require(

crypto.createECDH()

crypto.createECDH(curve_name) Creates an Elliptic Curve Diffie-Hellman (ECDH) key exchange object using a predefined curve specified by the curve_name string. Use crypto.getCurves() to obtain a list of available curve names. On recent OpenSSL releases, openssl ecparam -list_curves will also display the name and description of each available elliptic curve.

crypto.createDiffieHellman()

crypto.createDiffieHellman(prime[, prime_encoding][, generator][, generator_encoding]) Creates a DiffieHellman key exchange object using the supplied prime and an optional specific generator. The generator argument can be a number, string, or Buffer. If generator is not specified, the value 2 is used. The prime_encoding and generator_encoding arguments can be 'binary', 'hex', or 'base64'. If prime_encoding is specified, prime is expected to be a string; otherwise a Buffer is expected. If ge