Applied Cryptography
Hashing, digital signatures and elliptic curves
"Without cryptography, Bitcoin would literally be impossible." — Hal Finney (Bitcointalk, 2009)
1. Introduction
Bitcoin is, in essence, an economic system backed by mathematics. It does not rely on institutions, authorities or interpersonal trust: it relies on cryptographic functions that guarantee:
irreversibility
non-counterfeiting
public verifiability
digital ownership
attack resistance
This chapter covers the three fundamental cryptographic pillars:
Hash functions (SHA-256, RIPEMD-160)
Digital signatures (ECDSA)
Elliptic curves (secp256k1)
Each one plays a specific role within Bitcoin's design.
2. Cryptographic hashing in Bitcoin
2.1. What is a hash?
A cryptographic hash function is a transformation:
with the following properties:
Preimage resistance
Second-preimage resistance
Collision resistance
Determinism
Efficiency
Bitcoin primarily uses:
SHA-256
RIPEMD-160
And occasionally combinations like SHA-256(SHA-256(x)) (double SHA-256).
2.2. Key properties applied to Bitcoin's design
1. Collision resistance
Makes it impossible to find two different messages that produce the same hash.
This is essential for:
ensuring block integrity
preventing malicious reorganizations
guaranteeing transaction uniqueness
2. One-wayness
It is not possible to recover the original information from a hash.
It facilitates:
addressing without revealing public keys
resistance to future-spend attacks
protection against preimage collisions
2.3. Hashing in the system's different components
Block header
SHA-256d
To prove PoW
Merkle tree
SHA-256d
To aggregate transactions
Bitcoin address
SHA-256 + RIPEMD-160
To create short identifiers
3. Merkle trees: compression and verifiability
The transactions within each block are organized into a Merkle tree.
3.1. Formal definition
A Merkle tree is a binary structure where:
3.2. Advantages
They provide efficient proofs of inclusion (Merkle proofs)
They enable lightweight nodes (SPV)
They reduce the need for storage
These proofs are fundamental for mobile devices and light clients.
4. Digital signatures (ECDSA)
4.1. What are they for?
Bitcoin uses digital signatures to verify:
that the owner of a private key authorized a transaction
that the transaction was not modified
that the signature is publicly valid
4.2. Mathematical basis
If:
= private key
= public key (point on curve)
then the signature (r, s) satisfies:
where:
= random number per signature
= generator point
= order of the elliptic group
4.3. Security
ECDSA is secure as long as:
If reused, the private key can be derived:
This has caused hacks in defective implementations in the past.
5. Elliptic curves: the algebraic foundation
Bitcoin uses the elliptic curve secp256k1.
5.1. Mathematical definition
It is the curve:
over the finite field:
5.2. Properties
non-random curve (unlike NIST curves)
efficient operations
proven security
resistant to state manipulation (according to many cryptographers)
5.3. Point multiplication
The fundamental operation is:
where:
= 256-bit number
= generator point
= public key
It is easy to compute , but practically impossible to compute .
This is based on the difficulty of the Elliptic Curve Discrete Logarithm Problem (ECDLP).
6. Bitcoin addresses: from the hash to the Base58Check representation
6.1. Full generation process
Add version:
Calculate checksum:
Encode in Base58Check.
6.2. Simplified example in pseudocode
7. Cryptographic security against modern attacks
7.1. Quantum attacks
Bitcoin partially resists quantum attacks:
SHA-256
Low
Grover reduces security by 50%
ECDSA
Medium
Shor could derive public keys
Current mitigation:
public keys not exposed until spent
future possibility of changing algorithm
7.2. Collision attacks
SHA-256 has no known collisions.
A collision implies:
with
The probability is astronomically low ().
7.3. Implementation attacks
The most common attacks:
poor randomness generation
defective wallets
side-channel attacks
compromised hardware
Bitcoin as a protocol is secure; implementations may not be.
8. Cryptography applied on the blockchain
Bitcoin uses cryptography to secure:
Block integrity
SHA-256d hash
Transaction integrity
Merkle Root
Digital ownership
ECDSA
Double-spend prevention
PoW
Pseudonymous identities
Hash160
Initial block zeros
PoW target
9. Chapter conclusion
Cryptography in Bitcoin is not decorative. It is the source of:
security
decentralization
mathematical trust
irreversibility
censorship resistance
digital ownership
Bitcoin does not work because "everyone agrees" on its validity. It works because mathematics do not take bribes.
Bitcoin does not use cryptography to "hide" data. It uses cryptography to guarantee economic rules without intermediaries.
Last updated
Was this helpful?

