sha256.js 283 B

12345678
  1. var shim = require('./shim');
  2. module.exports = async function(d, o){
  3. var t = (typeof d == 'string')? d : JSON.stringify(d);
  4. var hash = await shim.subtle.digest({name: o||'SHA-256'}, new shim.TextEncoder().encode(t));
  5. return shim.Buffer.from(hash);
  6. }