Public Key Hash (PKH): The Anchor Guide to HASH160 Fingerprints
Public Key Hash (PKH): The Anchor Guide to HASH160 Fingerprints
Executive Summary: A Public Key Hash (PKH) is the 20-byte (160-bit) unique identifier derived from a Bitcoin public key. It is the result of the "HASH160" process—a combination of SHA-256 and RIPEMD-160 algorithms. PKHs are the core component of almost every Bitcoin address type (1..., 3..., bc1q...). They provide significant blockspace savings and an additional layer of "Quantum Shielding" by hiding the raw public key until the moment coins are spent.
🔍 Why This Module Matters
When you share a Bitcoin address, you aren't sharing your identity, and you aren't even sharing your "Public Key." You are sharing a Hash. This abstraction is one of the most brilliant parts of Bitcoin's design. This module will deconstruct the "HASH160" pipeline, explaining why Bitcoin uses two different hash functions, how it reduces a 65-byte key into a compact 20-byte fingerprint, and why this "Shield" is the primary defense against future cryptographic threats.
🏛️ The HASH160 Pipeline: Step-by-Step
To create a Public Key Hash, Bitcoin performs a "Double-Hash" operation. This is technically defined as:
RIPEMD160(SHA256(PublicKey))
1. The SHA-256 Layer (The Heavy Lifter)
First, the raw public key bytes are hashed using SHA-256.
-
Result: 32 bytes (256 bits).
-
Purpose: SHA-256 has massive collision resistance. It ensures that no two public keys could ever accidentally produce the same intermediate hash.
2. The RIPEMD-160 Layer (The Compactor)
Next, that 32-byte hash is hashed again using RIPEMD-160.
-
Result: 20 bytes (160 bits).
-
Purpose: RIPEMD-160 was specifically designed to produce a shorter output. This makes Bitcoin addresses shorter and easier to handle for humans.
⚙️ Why Hashing is Better than Raw Keys
| Feature | Raw Public Key | Public Key Hash (PKH) |
|---|---|---|
| Size | 33 or 65 Bytes | 20 Bytes |
| Blockchain Storage | Expensive (Bloat) | Cheap (Efficient) |
| Address Length | Very Long | Short (Compact) |
| Privacy | Low (Visible) | High (Obfuscated) |
1. Blockspace Economics
In the early days of Bitcoin (P2PK), full 65-byte keys were stored on the ledger. By switching to 20-byte hashes (P2PKH), Bitcoin reduced the storage requirement for every transaction by over 60%. This efficiency is what allows the blockchain to remain decentralized and small enough for home users to download.
2. The "Quantum Shield"
A public key is mathematically linked to a private key via elliptic curve math. If someone has your public key, a quantum computer could theoretically calculate your private key.
-
The PKH Defense: Because a hash is "One-Way," an observer cannot see your public key in your address. They only see the hash.
-
The Spend: Your public key is only revealed when you broadcast a transaction. An attacker would have only a few seconds (until the block is mined) to attempt a hack, making the attack practically impossible.
🛠️ From PKH to Address
A Public Key Hash is a raw binary string. To make it a "Bitcoin Address," we add a prefix and a checksum, then encode it in Base58 or Bech32.
-
Prefix
0x00+ PKH: Becomes a Legacy Address (starts with 1). -
Prefix
0x05+ PKH: Becomes a P2SH Address (starts with 3). -
Bech32 + PKH: Becomes a Native SegWit Address (starts with bc1q).
graph LR A[Public Key] --> B[SHA-256] B --> C[RIPEMD-160] C --> D[20-Byte PKH] D --> E[Base58 Encoding] E --> F[Address: 1BvBM...]
🎯 Learning Objectives for this Module
By the end of this module, you will be able to:
-
Define a Public Key Hash and its byte-size.
-
Explain the two-step "HASH160" process used to derive it.
-
Identify two reasons why Bitcoin uses a hash instead of a raw public key.
-
Understand how the "Quantum Shield" protects your coins.
-
Describe the relationship between a PKH and different address types (Legacy vs. SegWit).
🗺️ Module Roadmap: What's Next?
Now that we've fingerprinted the key, we will look at the math and tools:
-
Double-Hash Logic: Why we use SHA-256 and RIPEMD-160.
-
PKH Efficiency: Calculating the byte-savings of P2PKH.
-
Quantum Resistance Math: A deeper look at the "One-Way" barrier.
-
Python HASH160 Auditor: Writing a script to derive a PKH from a hex public key.
🎓 Summary
The Public Key Hash is the "Golden Ratio" of Bitcoin identifiers. It is small enough for the blockchain, secure enough for the future, and unique enough for every human on Earth. By mastering the PKH, you are understanding the primary data structure that secures the billions of dollars worth of value stored in Bitcoin's global UTXO set.
TeachMeBitcoin is an ad-free, open-source educational repository curated by a passionate team of Bitcoin researchers and educators for public benefit. If you found our articles helpful, please consider supporting our hosting and ongoing content updates with a clean donation: