• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Wp-gen
      • Dimacs-reader
      • Pfcs
      • Legacy-defrstobj
      • Proof-checker-array
      • Soft
      • C
      • Farray
      • Rp-rewriter
      • Instant-runoff-voting
      • Imp-language
      • Sidekick
      • Leftist-trees
      • Java
      • Taspi
      • Bitcoin
        • Bip32
        • Bech32
        • Bip39
        • Bip44
        • Base58
        • Bip43
        • Bytes
        • Base58check
        • Cryptography
          • Hash160
          • Bip-350
          • Bip-173
        • Riscv
        • Des
        • Ethereum
        • X86isa
        • Sha-2
        • Yul
        • Zcash
        • Proof-checker-itp13
        • Regex
        • ACL2-programming-language
        • Json
        • Jfkr
        • Equational
        • Cryptography
        • Poseidon
        • Where-do-i-place-my-book
        • Axe
        • Bigmems
        • Builtins
        • Execloader
        • Aleo
        • Solidity
        • Paco
        • Concurrent-programs
        • Bls12-377-curves
      • Debugging
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Cryptography

    Hash160

    Hash160 function.

    Signature
    (hash160 bytes) → hash
    Arguments
    bytes — Guard (byte-listp bytes).
    Returns
    hash — Type (byte-listp hash).

    This is SHA-256 followed by RIPEMD-160. It is sometimes called `Hash160', e.g. see the OP_HASH160 opcode, or see the documentation of BIP 32.

    Definitions and Theorems

    Function: hash160

    (defun hash160 (bytes)
      (declare (xargs :guard (byte-listp bytes)))
      (declare (xargs :guard (< (len bytes) (expt 2 61))))
      (let ((__function__ 'hash160))
        (declare (ignorable __function__))
        (ripemd-160-bytes (sha-256-bytes bytes))))

    Theorem: byte-listp-of-hash160

    (defthm byte-listp-of-hash160
      (b* ((hash (hash160 bytes)))
        (byte-listp hash))
      :rule-classes :rewrite)

    Theorem: len-of-hash160

    (defthm len-of-hash160
      (b* ((hash (hash160 bytes)))
        (equal (len hash) 20))
      :rule-classes :rewrite)