Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function deriveChecksumBits (entropyBuffer) {
var ENT = entropyBuffer.length * 8
var CS = ENT / 32
var hash = createHash('sha256').update(entropyBuffer).digest()
return bytesToBinary([].slice.call(hash)).slice(0, CS)
}
function ripemd160(data) {
return createHash("rmd160")
.update(data)
.digest();
}
function sha256(data, encoding) {
return createHash('sha256').update(data).digest(encoding)
}
function sha1(data, encoding) {
return createHash('sha1').update(data).digest(encoding)
}
getHash: function(str, format = `base64`) {
if (!str) {
return undefined;
}
const hash = createHash(`sha256`);
hash.update(str);
return hash.digest(format);
},
function ripemd160 (buffer) {
return createHash('rmd160').update(buffer).digest()
}
function sha256 (buffer) {
return createHash('sha256').update(buffer).digest()
}
hashPublicKey(buffer: Buffer) {
return createHash("rmd160")
.update(
createHash("sha256")
.update(buffer)
.digest()
)
.digest();
}
hashPublicKey(buffer: Buffer) {
return createHash("rmd160")
.update(
createHash("sha256")
.update(buffer)
.digest()
)
.digest();
}