simple-sha256 !travistravis-imagetravis-url !npmnpm-imagenpm-url !downloadsdownloads-imagedownloads-url !javascript style guidestandard-imagestandard-url
Generate SHA-256 hashes (in Node and the Browser)
In Node.js, this package usescrypto.createHash()
. In the browser, it uses crypto.subtle.digest()
.install
npm install simple-sha256
usage
Async (returns aPromise
):const sha256 = require('simple-sha256')
init()
async function init () {
const hash = await sha256('hey there')
console.log(hash)
// 74ef874a9fa69a86e091ea6dc2668047d7e102d518bebed19f8a3958f664e3da
}
Sync:
const sha256 = require('simple-sha256')
console.log(sha256.sync('hey there'))
// 74ef874a9fa69a86e091ea6dc2668047d7e102d518bebed19f8a3958f664e3da