Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
hash() {
const to_hash = this.type === "uncompressed" ? this.uncompressed : this.compressed;
const sha256 = shajs("sha256")
.update(to_hash.toHex(), "hex")
.digest("hex");
const ripe = new ripemd160().update(sha256, "hex").digest("hex");
return new ByteBuffer.fromHex(ripe);
}
p2wshHash() {
const sha256 = shajs("sha256")
.update(this.body.toHex(0, this.body.capacity()), "hex")
.digest("hex");
return new ByteBuffer.fromHex(sha256);
}
hash() {
const serialized = this.serialize();
const hex = serialized.toHex(0, serialized.capacity());
return $.swapHex(
shajs("sha256")
.update(
shajs("sha256")
.update(hex, "hex")
.digest("hex"),
"hex"
)
.digest("hex")
);
}
function calculateChecksumBits(entropy) {
var sha_256 = shajs("sha256").update(entropy, "hex").digest("hex");
var entropy_sha256 = $.hexToBinary(sha_256);
return entropy_sha256.substring(0, entropy.length * 4 / 32);
}
create: Helpers.resolve_create(mean.db, "passkey", "passkeys", passkey => {
passkey["code"] = shajs('sha256').update(passkey.code).digest('hex');
return passkey;
}),
update: Helpers.resolve_update(mean.db, "passkey")
public static generateCodeVerifier(): string {
this.CodeVerifier = uniqueId(32);
let codeChallenge = shajs('sha256').update(this.CodeVerifier).digest('hex');
return codeChallenge;
}
sha256: function(str) {
return sha('sha256')
.update(str)
.digest('hex');
},
blockHash() {
const serialized = this.serialize();
const hex = serialized.toHex(0, serialized.capacity());
return $.swapHex(
shajs("sha256")
.update(
shajs("sha256")
.update(hex, "hex")
.digest("hex"),
"hex"
)
.digest("hex")
);
}
}
module.exports = function createHash (alg) {
alg = alg.toLowerCase()
if (alg === 'md5') return new MD5()
if (alg === 'rmd160' || alg === 'ripemd160') return new RIPEMD160()
return new Hash(sha(alg))
}
module.exports = function createHash (alg) {
alg = alg.toLowerCase()
if (alg === 'md5') return new MD5()
if (alg === 'rmd160' || alg === 'ripemd160') return new RIPEMD160()
return new Hash(sha(alg))
}