simple-sha256
Version:
Generate SHA-256 hashes (in Node and the Browser)
16 lines (12 loc) • 340 B
JavaScript
/*! simple-sha256. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
module.exports = sha256
module.exports.sync = sha256sync
const crypto = require('crypto')
async function sha256 (buf) {
return sha256sync(buf)
}
function sha256sync (buf) {
return crypto.createHash('sha256')
.update(buf)
.digest('hex')
}