fundamentals

cryptography

Cryptography is the mathematical foundation of Bitcoin. Hash functions, public and private keys, and digital signatures work together to make transactions verifiable and secure without requiring anyone to trust a central authority.

Cryptography is the branch of mathematics concerned with securing information and communication. Bitcoin does not rely on banks or governments to verify transactions. Instead, it uses cryptographic tools that anyone can check independently. Three of these tools are central to how Bitcoin works: hash functions, public and private key pairs, and digital signatures.

A hash function takes any input and produces a fixed-length output called a hash or digest. SHA-256, the function used in Bitcoin, always produces a 256-bit output. Changing even a single character in the input produces a completely different hash. This makes hashes useful for verifying data integrity and forms the basis of Bitcoin mining, where miners must repeatedly hash data until they find an output that meets a specific target. Public and private key cryptography works differently. A private key is a large random number that only the owner knows. A corresponding public key is derived from it mathematically and can be shared openly. The bitcoin address a person shares with others is derived from their public key. Because the relationship between private and public key is one-way, knowing the public key or address gives no information about the private key.

A digital signature ties these elements together. When sending bitcoin, the sender uses their private key to sign the transaction. Anyone on the network can verify this signature using the sender's public key, confirming that the transaction was authorised by the owner of those funds without ever revealing the private key. This combination makes Bitcoin trustless: transactions are secured by mathematics rather than by institutions, and every participant can independently verify every claim.

Frequently asked questions

What is SHA-256 and why does Bitcoin use it?

SHA-256 is a cryptographic hash function developed by the US National Security Agency and published by the National Institute of Standards and Technology. It takes any input and produces a 256-bit output. Bitcoin uses it in two places: in the mining process, where miners hash block headers to find a valid proof of work, and in deriving bitcoin addresses from public keys. SHA-256 was chosen for its security properties. It is computationally fast in one direction but finding an input that produces a specific output requires enormous effort, which is precisely what makes mining difficult and the blockchain tamper-resistant.

How do public and private keys keep bitcoin secure?

A private key is a randomly generated number so large that the chance of someone else generating the same one is negligible. A public key is derived from it using elliptic curve mathematics, a one-way process that cannot be reversed in any practical timeframe. When you send bitcoin, you sign the transaction with your private key, producing a digital signature. Anyone on the network can verify that signature using your public key without ever seeing the private key itself. As long as the private key is kept secret, the funds associated with it are protected by mathematics rather than by any institution.

Do you need to understand cryptography to use Bitcoin?

No. Bitcoin wallets handle all cryptographic operations automatically. When you create a wallet, keys are generated on your device. When you send bitcoin, the wallet signs the transaction without you needing to interact with keys directly. Understanding the underlying cryptography helps explain why Bitcoin works the way it does and why certain practices like securing your seed phrase matter, but day-to-day use does not require any mathematical knowledge.