Crypto algorithm list


I'm trying to find a list of strings that can be used a a crypto algorithm to fit into this function, replacing SHA256.

crypto.createHmac("SHA256", secret).update(string).digest('base64'),

I've come to the understanding that crypto uses openssl, and that the algorithms are specific to each system running node.js.

With the following commands you can see a list of all algorithms available for your system.

openssl list-cipher-algorithms 
openssl list-cipher-commands 

I've outputted the content of those two commands to this gist.

What bothers me is that SHA256 is not in either of those lists.

I would really like the definitive algorithm list.

1/5/2013 4:49:22 AM

Accepted Answer

The learning here is that ciphers and hashes are different and use different algorithms. With node's crypto use .getCiphers() and .getHashes() methods to return an array with the names of the supported ciphers and hashes respectively.

var crypto = require('crypto')

Which logs the following ciphers:

[ 'CAST-cbc',
  'seed-ofb' ]

And the following hashes:

[ 'DSA',
  'whirlpool' ]

Here's my settings:

  • openssl version is OpenSSL 0.9.8zg 14 July 2015
  • node --version is v0.12.4
9/16/2015 9:01:12 PM

The openssl docs have a page listing all valid cipher strings:

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow