runtime-node-crypto
Version:
A Node compatible Crypto module for runtimejs
19 lines (15 loc) • 366 B
JavaScript
;
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;