UNPKG

runtime-node-crypto

Version:
19 lines (15 loc) 366 B
'use strict'; var sha = require('sha.js'); class Hash { constructor(alg, opt) { this._handle = sha(alg); // in node, _handle is the backend, so sha is the _handle for this } update(cont, encoding) { this._handle.update(cont, encoding); return this; } digest(encoding) { return this._handle.digest(encoding); } } module.exports = Hash;