Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
if (typeof base !== 'number') {
return throwError.call(this, 'base must be a number', cb);
}
if (base < 2 || base > 64) {
return throwError.call(
this,
'base must be a number between 2 and 64',
cb
);
}
let hash = this.pHash();
hash = anyBase(anyBase.BIN, alphabet.slice(0, base))(hash);
while (hash.length < maxHashLength[base]) {
hash = '0' + hash; // pad out with leading zeros
}
if (isNodePattern(cb)) {
cb.call(this, null, hash);
}
return hash;
}
export default (content) => (
anyBase(anyBase.HEX, 'abcdefghijklmnopqrstuvwxyz')(
new SHA256()
.update(content, 'utf-8')
.digest('hex')
)
);