(sigil bitcoin primitives)
(sigil bitcoin primitives) — Bitcoin hash combinators
Pure Sigil library providing HASH160, HASH256, and BIP-340 tagged hashes.
(import (sigil bitcoin primitives))
(hash160 #u8(0 1 2 3)) ; => 20-byte bytevector
(hash256 #u8(0 1 2 3)) ; => 32-byte bytevector
(tagged-hash "MyTag" #u8(0 1 2 3)) ; => 32-byte bytevectorExports
hash160procedureCompute HASH160 = RIPEMD160(SHA256(data)).
Returns a 20-byte bytevector. Used for P2PKH and P2SH address derivation.
(hash160 "hello")
(hash160 #u8(0 1 2 3))hash256procedureCompute HASH256 = SHA256(SHA256(data)).
Returns a 32-byte bytevector. Used for transaction IDs (txid) and block hashes.
(hash256 "hello")
(hash256 #u8(0 1 2 3))tagged-hashprocedureCompute a BIP-340 tagged hash.
tagged_hash(tag, x) = SHA256(SHA256(tag) || SHA256(tag) || x)
tag is a UTF-8 string (e.g. "BIP0340/challenge"). x is a bytevector. Returns a 32-byte bytevector.
(tagged-hash "MyApp/v1" #u8(0 1 2 3))bip0340/challengevariable(No description)
bip0340/auxvariable(No description)
bip0340/noncevariable(No description)
taproot/elementsvariable(No description)