TeachMeBitcoin

Public Key Hash (PKH): The Anchor Guide to HASH160 Fingerprints

From TeachMeBitcoin, the free encyclopedia Reading time: 4 min

Public Key Hash (PKH): The Anchor Guide to HASH160 Fingerprints

IMPORTANT

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.

2. The RIPEMD-160 Layer (The Compactor)

Next, that 32-byte hash is hashed again using RIPEMD-160.


⚙️ 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.


🛠️ 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.

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:

  1. Define a Public Key Hash and its byte-size.

  2. Explain the two-step "HASH160" process used to derive it.

  3. Identify two reasons why Bitcoin uses a hash instead of a raw public key.

  4. Understand how the "Quantum Shield" protects your coins.

  5. 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:

  1. Double-Hash Logic: Why we use SHA-256 and RIPEMD-160.

  2. PKH Efficiency: Calculating the byte-savings of P2PKH.

  3. Quantum Resistance Math: A deeper look at the "One-Way" barrier.

  4. 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.

☕ Help support TeachMeBitcoin

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:

Ethereum: 0x578417C51783663D8A6A811B3544E1f779D39A85
Bitcoin: bc1q77k9e95rn669kpzyjr8ke9w95zhk7pa5s63qzz
Solana: 4ycT2ayqeMucixj3wS8Ay8Tq9NRDYRPKYbj3UGESyQ4J
Address copied to clipboard!