Skip to content

Instantly share code, notes, and snippets.

@transitive-bullshit
Created January 26, 2020 22:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save transitive-bullshit/62274256bfad55c3b55762a982c56b5d to your computer and use it in GitHub Desktop.
Save transitive-bullshit/62274256bfad55c3b55762a982c56b5d to your computer and use it in GitHub Desktop.
const crypto = require('crypto')
const hash = (d) => {
const buffer = Buffer.isBuffer(d) ? d : Buffer.from(d.toString())
return crypto.createHash('sha256').update(buffer).digest('hex')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment