sha256.js 459 B

12345678910111213
  1. const shim = require('./shim');
  2. const Buffer = require('./buffer')
  3. const parse = require('./parse')
  4. const { pbkdf2 } = require('./settings')
  5. // This internal func returns SHA-256 hashed data for signing
  6. const sha256hash = async (mm) => {
  7. const m = parse(mm)
  8. const hash = await shim.subtle.digest({name: pbkdf2.hash}, new shim.TextEncoder().encode(m))
  9. return Buffer.from(hash)
  10. }
  11. module.exports = sha256hash