Hashing Algorithms
Hashing algorithms are mathematical functions that convert input data of any size into a fixed-size output (hash), used for data integrity, password storage, and blockchain consensus.
Hashing algorithms are fundamental cryptographic primitives that take arbitrary input and produce a fixed-length output called a hash or digest. They are designed to be deterministic (same input always produces same output), fast to compute, and infeasible to reverse (one-way function).
Cryptographic hash functions must satisfy additional properties: collision resistance (hard to find two inputs with same hash), preimage resistance (hard to find input from hash), and avalanche effect (small input changes cause large output changes).
Key algorithms include: SHA-256 (Bitcoin, widely used), Keccak-256 (Ethereum), SHA-3 (NIST standard), Blake2/Blake3 (fast, secure), and Poseidon (ZK-friendly). Different algorithms offer trade-offs in security, speed, and suitability for specific uses like zero-knowledge proofs.
Blockchain uses include: proof-of-work mining, Merkle trees for data integrity, address generation, transaction IDs, and commitment schemes. Understanding hashing is essential for blockchain security and development.
graph LR
Center["Hashing Algorithms"]:::main
Pre_cryptography["cryptography"]:::pre --> Center
click Pre_cryptography "/terms/cryptography"
Pre_mathematics["mathematics"]:::pre --> Center
click Pre_mathematics "/terms/mathematics"
Rel_proof_of_work["proof-of-work"]:::related -.-> Center
click Rel_proof_of_work "/terms/proof-of-work"
Rel_digital_signatures["digital-signatures"]:::related -.-> Center
click Rel_digital_signatures "/terms/digital-signatures"
classDef main fill:#7c3aed,stroke:#8b5cf6,stroke-width:2px,color:white,font-weight:bold,rx:5,ry:5;
classDef pre fill:#0f172a,stroke:#3b82f6,color:#94a3b8,rx:5,ry:5;
classDef child fill:#0f172a,stroke:#10b981,color:#94a3b8,rx:5,ry:5;
classDef related fill:#0f172a,stroke:#8b5cf6,stroke-dasharray: 5 5,color:#94a3b8,rx:5,ry:5;
linkStyle default stroke:#4b5563,stroke-width:2px;
🧒 Explain Like I'm 5
Generated ELI5 content
🤓 Expert Deep Dive
Generated expert content
❓ Frequently Asked Questions
Why can't you reverse a hash to get the original input?
Hash functions compress arbitrary amounts of input into fixed-size output, so many possible inputs map to each hash (information is lost). They're also designed with mathematical complexity that makes reversal computationally infeasible. This is called preimage resistance.
What hashing algorithm does Bitcoin use?
Bitcoin uses SHA-256 (SHA-256d, actually double SHA-256) for proof-of-work mining and transaction hashing, and RIPEMD-160 combined with SHA-256 for address generation. These choices balance security, performance, and resistance to known attacks.
What makes a hash function 'ZK-friendly'?
ZK-friendly hash functions like Poseidon and Pedersen are designed to be efficient when used inside zero-knowledge proof circuits. Traditional hashes like SHA-256 are expensive in ZK proofs because they use bitwise operations that are costly to prove. ZK-friendly hashes use arithmetic operations native to the proof systems.