Skip to content

Instantly share code, notes, and snippets.

@hashmaparraylist
Last active May 25, 2016 08:57
Show Gist options
  • Save hashmaparraylist/898fad4ed5154007bc7014068d56b945 to your computer and use it in GitHub Desktop.
Save hashmaparraylist/898fad4ed5154007bc7014068d56b945 to your computer and use it in GitHub Desktop.
use node.js hash string. support sha1, md5 etc. `openssl list-message-digest-algorithms` will display the available digest algorithms.
let crypto = require('crypto');
function hashString(algorithm, string) {
return crypto.createHash(algorithm).update(string).digest('hex');
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment