Cryptography is a vast and varied field of study. The study of hashing algorithms, encryption and decryption, and public and private keys all fall in the realm of cryptography. At their core, all three of these concepts are in fact based in math and probability. Bitcoin makes use of cryptography in many ways to create a permissionless, trustless, immutable, decentralized, system.
Bitcoin uses public key cryptography, the use of public and private keys, to allow users to independently generate their own keys and send and receive Bitcoin in a permissionless, trustless manner. The fact that users can “sign up” to Bitcoin without any third party or verification is critical to its permissionless nature. If users had to request a set of keys from a central authority to use the network, Bitcoin would scarcely differ from the current banking system.
Additionally, when one user sends their public key to another user to receive bitcoin, they have an assurance that the sender cannot use the public key to steal any funds from them. This is fundamentally different from the legacy financial system, wherein an employer or vendor has access to your bank account as soon as you hand over your bank information or swipe your credit card. While most vendors remain honest, they have the ability to overcharge you at any point. You trust them, hoping your bank or government will make things right if they go rogue. Trustlessness is critical to a decentralized system such as Bitcoin, and public key cryptography enables users to trust no one.
Bitcoin leverages hash functions to maintain the blockchain’s immutability and decentralize the network. When a miner hashes a block hoping to find a valid hash, the hash of the previous block is included in that block. Thanks to the properties of a hash function, if the hash of the previous block changes, this will change the current block’s hash, invalidating the Proof-of-Work and thus the entire block. For example, if the blockchain has 500 blocks, Block #400’s hash will include Block #399’s hash. If a single piece of Block #399 is altered, Block #399’s hash will change, causing Block #400’s hash to change and so on, all the way until Block #500. Every block after Block #399 will be invalidated. This trait prevents anyone from altering a block once it is part of the blockchain without completely rebuilding the blockchain.
The process of mining also trends towards decentralization thanks to the properties of the hash function and the Proof-of-Work requirement. Because the hashing algorithm is public, anyone with access to computing power is capable of mining Bitcoin. Because the hashing algorithm is random, larger players are unable to game the system and force smaller players out. The rewards of mining are directly correlated with work done, albeit in a probabilistic manner. These two dynamics keep Bitcoin mining decentralized, securing Bitcoin against 51% attacks or regulatory capture.