Skip to content

Instantly share code, notes, and snippets.

@edmon1024
Forked from thinkphp/gist:5110833
Created February 5, 2019 03:11
Show Gist options
  • Save edmon1024/c96c831a3a6b4042c35bc4bb3690cfd4 to your computer and use it in GitHub Desktop.
Save edmon1024/c96c831a3a6b4042c35bc4bb3690cfd4 to your computer and use it in GitHub Desktop.
Creating sha-1 on Node.js.
var crypto = require('crypto');
function sha1( data ) {
var generator = crypto.createHash('sha1');
generator.update( data )
return generator.digest('hex')
}
console.log( sha1('adrian') )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment