This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const crypto = require('crypto') | |
const assert = require('assert') | |
function sha256 (buffer) { | |
assert(Buffer.isBuffer(buffer), `Argument must be a buffer, received ${typeof buffer}`) | |
const hash = crypto.createHash('sha256') | |
hash.update(buffer) | |
return hash.digest() | |
} |