Hash Function (SHA-256)
One-way mathematical function — foundation of Bitcoin mining and blockchain integrity.
A hash function is a mathematical one-way function that converts any input into a fixed-length "fingerprint" — deterministic, fast, but irreversible.
SHA-256 (Secure Hash Algorithm 256):
•Bitcoin uses SHA-256 for mining and block hashing
•Input: any data (text, file, block)
•Output: always 256-bit string (64 hex characters)
•Example: SHA256("bitcoin") = 6b88c087247aa2f07ee1c5956b8e1a9f4c7f892a70e324f1bb3d161e05ca107b
Properties:
•Deterministic: same input → always same output
•One-way: cannot reconstruct input from hash
•Avalanche effect: changing 1 input bit → completely different hash
•Collision resistant: near impossible to find two inputs with same hash
Where used in crypto:
•Mining: miners search for hash < target (proof of work)
•Block chain: every block contains hash of previous
•Wallet addresses: public key → SHA256 → RIPEMD-160 → address
•Merkle tree: transactions in block hashed into structure
Other hash algorithms:
•Ethereum: Keccak-256 (similar to SHA-3)
•Scrypt: Litecoin, memory-hard
•Blake2b, Blake3: modern alternatives