BitcoinMachine
TECHNICAL_DOC // CRYPTOGRAPHY / RIPEMD-160
RIPEMD-160
RIPEMD-160 (Race Integrity Primitives Evaluation Message Digest) is a 160-bit cryptographic hash function developed in Europe in 1996. Bitcoin uses it as the second hash in address generation — after SHA-256 — to produce compact 20-byte addresses. It provides a different security lineage from the NSA-designed SHA family.
HASH160 — ADDRESS DERIVATION
Public Key (33 bytes compressed): 0279BE667EF9DCBBAC55A06295CE870B07... Step 1 — SHA-256: SHA256(pubkey) = 0B7A385B...32 bytes Step 2 — RIPEMD-160: RIPEMD160(sha256_result) = 751E76E8199196F454F0D9D762E8B308E6895B14 ↑ 20 bytes = 40 hex chars This 20-byte value is called HASH160(pubkey) or PKH (Public Key Hash). It becomes the core of a P2PKH or P2WPKH address.
ALSO USED IN
script-hash/">SCRIPT HASH — P2SH ADDRESS DERIVATION
Redeem Script → SHA256 → RIPEMD-160 = 20-byte script hash P2SH address encodes this 20-byte hash with version byte 0x05 → Base58Check encoded address starting with "3" OP_HASH160 in Bitcoin Script = SHA256 followed by RIPEMD-160
Why RIPEMD-160 After SHA-256?
DUAL HASH DESIGN
Using two independent hash functions in sequence provides defense-in-depth. If a weakness is found in SHA-256, RIPEMD-160 acts as a second barrier, and vice versa. The output is also shorter (20 bytes vs 32 bytes), reducing address size.
Design principle: HASH160(x) = RIPEMD160(SHA256(x)) If SHA256 is broken: Attacker finds x,y where SHA256(x) == SHA256(y) But RIPEMD160(SHA256(x)) ≠ RIPEMD160(SHA256(y)) (usually) → Address collision not automatically achieved If RIPEMD160 is broken: Attacker finds a,b where RIPEMD160(a) == RIPEMD160(b) But preimage finding still requires breaking SHA256 first Both must fail simultaneously for address collision
Output size160 bits (20 bytes)
block-size/">Block size512 bits
Rounds160 (5 × 16, two parallel lines)
Developed byHans Dobbertin, Antoon Bosselaers, Bart Preneel (1996)
Based onMD4 / MD5 design (Merkle-Damgård construction)
Bitcoin OP codeOP_RIPEMD160, OP_HASH160
TERMINOLOGY_INDEX
RIPEMD-160
160-bit hash function used as the second hash in Bitcoin address generation (after SHA-256).
HASH160
SHA256 followed by RIPEMD-160. Produces the 20-byte public key hash used in P2PKH and P2WPKH addresses.
PKH
Public Key Hash. The 20-byte HASH160 output that forms the core of a Bitcoin address.
OP_HASH160
A Bitcoin Script opcode that applies SHA256 then RIPEMD-160 to the top stack item.
Merkle-Damgård
The hash construction used by RIPEMD-160, MD5, SHA-1, and SHA-256. Processes input in fixed-size blocks.