Private Key Tools

hash160 → P2PKH / P2SH / P2WPKH addresses

A hash160 is the 20-byte fingerprint RIPEMD160(SHA256(pubkey)). On its own it produces no address; wrapped with a version byte and a checksum it becomes a 1… or 3… address, and wrapped in bech32 it becomes bc1q…. This page shows every one of those wrappings side by side — and why a Taproot address can never come out of one.

40 hex digits = 20 bytes = 160 bits, e.g. 21f57b6debcfc5b67182dfb4af1641f0a8189012. An optional 0x prefix, spaces and upper-case letters are accepted; shorter values are left-padded. The demo value is RIPEMD160(SHA256(02ff812e26116a9aa140abe629e7f8a38401653caf925119def59ed3758c67ee80)).
No input yet

Enter a value above and press Convert. Not sure what to type? Press “Use example” to load the sample from the placeholder.

How it works

What this page computes

You give it one value — a 20-byte hash160 — and it shows you every address that can be built from it, plus the raw bytes each address commits to. The hash itself is one line of arithmetic:

hash160(pubkey) = RIPEMD160( SHA256(pubkey) )
33-byte public key→ SHA-256 (32 B)→ RIPEMD-160 (20 B)→ version byte ‖ hash160→ Base58Check→ 1… / 3… address

This page starts at the third box: the hashing is already done, and everything below is pure wrapping. That is the useful part to understand, because the same 20 bytes become a 1…, a 3…, a bc1q… or a tb1q… address depending only on which bytes are glued in front of them.

1. What a cryptographic hash function is

A hash function takes an input of any length and returns a fixed-length fingerprint. Cryptographers require three separate properties from it, and each one is doing different work inside a Bitcoin address.

PropertyMeaningCost for a 160-bit outputWhat it protects here
Preimage resistanceGiven a digest h, find any input x with H(x) = h≈ 2160 = 1 461 501 637 330 902 918 203 684 832 716 283 019 655 932 542 976 attemptsStops anyone minting a brand-new public key that hashes to your address and spending your coins with that key's own private key
Second-preimage resistanceGiven one specific input x, find a different x′ with H(x′) = H(x)≈ 2160Matters once your public key is public: nobody can substitute another key for the exact one you already spent from
Collision resistanceFind any two inputs x ≠ x′ with the same digest≈ 280 = 1 208 925 819 614 629 174 706 176 (birthday bound)Stops a counterparty building two keys with one address, showing you the harmless one and spending with the other

The first property is the one people misread. The address is the hash, so there is nothing to "derive the address from" — see section 4. What preimage resistance really buys you is that the set of public keys mapping to a given address is effectively unreachable: to spend a P2PKH output you must reveal a public key with that exact hash160 and sign with its private key, and the attacker may choose both. If a preimage were findable in 240 steps instead of 2160, an attacker would simply generate a fresh keypair whose public key hashes to your address and empty it. Preimage resistance is the property that makes a published address safe to leave unspent forever.

2. Why RIPEMD160(SHA256(x)) and not a single hash

Both halves are deliberate, and they are answering two different questions.

ConstructionOutputCollision resistancePreimage resistanceTrade-off
SHA256(x)32 bytes21282256Strongest collision bound, but every output in a script and in the UTXO set would be 12 bytes bigger
RIPEMD160(x)20 bytes2802160Compact, but only one hash function stands between the attacker and you
SHA256(x) truncated to 20 B20 bytes2802160No second function; also reuses the same internal state and padding rules
RIPEMD160(SHA256(x))20 bytes2802160Two independent designs in series — what Bitcoin uses

Read it as an assembly line. SHA-256 is a modern, well-studied 256-bit function; running it first makes the value that enters the second stage a uniformly random 32-byte string, so RIPEMD-160 never sees structured input from an attacker. RIPEMD-160 then shrinks the commitment to 20 bytes, and that saving is real money:

ItemWith a 20-byte commitmentWith a 32-byte commitmentSaved per output
P2PKH scriptPubKey25 bytes (76a914 ‖ 20 B ‖ 88ac)37 bytes12 bytes
Base58Check address34 characters (25 bytes encoded)≈ 50 characters16 characters
Witness v0 program20 bytes (P2WPKH)32 bytes (P2WSH-sized)12 bytes

Twelve bytes multiplied by every unspent output in the chain, forever, is a strong argument. The second argument is defence in depth: a break of one function does not immediately break the construction. To forge a collision in RIPEMD160(SHA256(x)) an attacker must produce two inputs whose SHA-256 digests collide, that is to say they must break SHA-256 as well, or attack RIPEMD-160 through an interface where they control only 32-byte inputs.

The composed function is not twice as strong

Chaining hashes does not multiply security. The collision resistance of RIPEMD160(SHA256(x)) is still bounded by the weakest link in that attack path — RIPEMD-160's 280 birthday bound — because a collision in the final output is enough. The composition buys resistance to cryptanalytic breaks and a fixed 32-byte input length for the inner stage, not a bigger number.

3. The birthday bound, and why 160 bits is enough

Preimage attacks need work proportional to the output space, 2160. Collisions are cheaper because of the birthday paradox: in a room of 23 people two share a birthday, and for hashes the expected search is about

collision search ≈ 1.2533 × 2n/2   →   n = 160 ⇒ 280 ≈ 1.21 × 1024
Digest sizePreimage workCollision workUsed by
128 bits2128264MD5-class designs — long broken in practice
160 bits2160280hash160: RIPEMD-160 inside Bitcoin addresses
256 bits22562128SHA-256, used for the outer stage and for Taproot's tagged hashes

280 is the honest weak point of hash160, and it is considered acceptable for three reasons: a collision only pays off if the attacker can then persuade someone to use one of the two colliding keys; the attacker must also match SHA-256, because the second stage takes only 32-byte inputs; and RIPEMD-160's 160-bit width was a standardised, internationally vetted choice (it was selected by the EU's RIPE project) rather than a first attempt. If you are generating addresses for somebody else and they never verify that you do not know the key, collision resistance is the property that is supposed to protect them — and it is the one with the smallest margin.

4. The address is not a secret — what actually protects your coins

Look at a real address's insides: 146ZNjH7…2UqT is nothing but Base58Check(0x00 ‖ hash160). The hash is in the address, published on every invoice, in every QR code, on every block explorer. Nobody is trying to hide it, and "you cannot reverse the hash to find my address" is not a security argument — the address was given away on purpose.

What protects the coins is a combination of three things:

Address typeWhat the chain stores while unspentWhat the spend revealsQuantum exposure
P2PKH (1…)hash160 of the keyThe 33- or 65-byte public keyLow until spent: only a 160-bit preimage is exposed
P2SH-P2WPKH (3…)hash160(0x0014 ‖ hash160)The 22-byte redeemScript and the public keyLow until spent
P2WPKH (bc1q…)The 20-byte witness programThe compressed public keyLow until spent
P2TR (bc1p…)The 32-byte x-only output key — a curve pointA signature (key path)High from the moment it is funded

That last row is why hashing still matters in a post-quantum discussion. Shor's algorithm solves the elliptic-curve discrete logarithm, so it can recover a private key from a public key that is visible on-chain. For an unspent P2PKH output there is no point visible — only a hash — so a quantum attacker must attack the hash instead, where Grover's algorithm gives only a quadratic speed-up (2160 → roughly 280 quantum steps). Taproot chose the opposite trade-off: its output key is a curve point sitting on-chain, which is what makes it cheap to verify and private to cooperate on, and also what makes it the first thing a quantum adversary could take.

5. Byte-level layout of everything this page prints

AddressBytes fed to the address encoderLengthFirst characters
P2PKH mainnet0x00 ‖ hash16021 B + 4 B checksum1…, always 34 characters
P2PKH testnet0x6F ‖ hash16021 B + 4 Bm… or n…
P2SH-P2WPKH mainnet0x05 ‖ hash160(0x0014 ‖ hash160)21 B + 4 B3…
P2SH-P2WPKH testnet0xC4 ‖ hash160(0x0014 ‖ hash160)21 B + 4 B2…
P2WPKH mainnet"bc" + separator + witness v0 + 32 five-bit words42 charactersbc1q…
P2WPKH testnet"tb" + separator + witness v0 + same words42 characterstb1q…

Note the double hashing in the P2SH-P2WPKH row. A nested SegWit address does not commit to your public-key hash directly; it commits to hash160 of the 22-byte redeemScript 0x0014 ‖ hash160, which is why its payload is a different 20 bytes from every other row.

6. Worked example with the sample hash160

These are the values this page actually prints for 21f57b6d…89012, computed here and not copied from anywhere:

StepValue
SHA-256 of the public key067eb00a0b9864633b020eef374476142daba913c5481ad6a4741cc8ab702617
RIPEMD-160 of that digest = hash16021f57b6debcfc5b67182dfb4af1641f0a8189012
P2PKH payload 00 ‖ hash1600021f57b6debcfc5b67182dfb4af1641f0a8189012
Its double-SHA256 checksum (first 4 bytes)cbd7667e
P2PKH mainnet address146ZNjH7XTXnMd1ofe3z7CL2i8WM7N2UqT
P2PKH testnet payload 6F ‖ hash1606f21f57b6debcfc5b67182dfb4af1641f0a8189012 (checksum 8c66f080)
P2PKH testnet addressmicWfnN6LUy38jVRPD2Mw7YMa873zjixGw
RedeemScript 0014 ‖ hash160001421f57b6debcfc5b67182dfb4af1641f0a8189012
Its hash160 = script hash823333d5fd23a83661e8e47629552c4a5bfc8b6e
P2SH payload 05 ‖ script hash05823333d5fd23a83661e8e47629552c4a5bfc8b6e (checksum acbfef44)
P2SH-P2WPKH mainnet address3DZT76KyKyc5zkzvLugP8umgt4RPY4XPQw
P2SH-P2WPKH testnet address2N57fAqFzwS7SCYdU23JFkrkx6QdZKurmpU
P2WPKH mainnet addressbc1qy86hkm0telzmvuvzm76279jp7z5p3yqjnaerk6
P2WPKH testnet addresstb1qy86hkm0telzmvuvzm76279jp7z5p3yqjemzsdf
Witness program words (after version 0)y86hkm0telzmvuvzm76279jp7z5p3yqj + checksum naerk6
P2PKH scriptPubKey76a91421f57b6debcfc5b67182dfb4af1641f0a818901288ac
P2WPKH scriptPubKey001421f57b6debcfc5b67182dfb4af1641f0a8189012

Six different addresses, one hash, zero cryptography beyond the two hash calls that produced it. If you change a single input byte anywhere upstream, every row in that table changes.

7. A Taproot address cannot be built from a hash160

This is the one thing on the page that is not possible, and the reason is structural, not a limitation of this tool. A P2TR output commits to a 32-byte x-only output key, computed as

Q = P + TapTweak(P) · G  where P is the internal key, an actual point on secp256k1

Producing that requires the full curve point: the tweak is taggedHash("TapTweak", x(P)), the addition needs a real point with a known y, and the result must be a point whose private key the owner can actually use. A hash160 is 20 bytes of digest; it is not a point, it has no y, and — crucially — nobody knows the discrete log of the point you would get by treating it as an x coordinate, even though the curve equation may well have a solution for it.

What P2TR needsWhat a hash160 provides
A 32-byte x coordinate of a real key20 bytes; 12 bytes shorter than a valid field element
A point whose private key the owner holdsA digest — no corresponding known scalar
A TapTweak derived from the internal keyNothing to tweak; the tweak cannot be computed
bech32m, witness version 1, 32-byte programOnly bech32 v0 (20 bytes) or Base58Check payloads
Do not "pad and pretend"

For the sample value, left-padding the 20 bytes to 32 and treating them as an x coordinate happens to land on a valid curve point, producing bc1pkc3xmm086pdgtvrkcg33cn90lhv9aq6f3ueuu9gvwdeeqrzmr5qsejuhs7. Nobody holds the private key for it. Sending bitcoin there is indistinguishable from sending it to a burn address. The genuine Taproot address for the same key is bc1pmsrhxnvmj8tjxxu9wj69ntvwvhvr28qufyc26tshz3rjj777tx3sh54u63, and it can only be derived from the full public key 02ff812e…ee80, never from its hash.

8. Where this value comes from and what comes next

9. Security notes and common mistakes

No network calls, no clipboard, no tracking

Every value on this page is computed by the PHP process serving it. Nothing is sent anywhere, and the hash160 you paste is not logged.

10. Quick reference

ItemValue
FormulaRIPEMD160(SHA256(pubkey))
Output size20 bytes / 40 hex characters / 160 bits
Addresses derivable from itP2PKH (mainnet + testnet), P2SH-P2WPKH (mainnet + testnet), P2WPKH (mainnet + testnet)
Addresses not derivableP2TR / Taproot — needs the full curve point
Base58Check payload length21 bytes (1 version byte + 20 body bytes), plus a 4-byte checksum
P2PKH address length34 characters on both networks
P2WPKH address length42 characters (bc1q… or tb1q…)
P2SH-P2WPKH payloadhash160(0x0014 ‖ hash160), not hash160 itself
Preimage resistance2160
Collision resistance280 (birthday bound)