Hashing

Hashing is the process of using a mathematical function to convert an input of arbitrary size to a fixed-size output.

Workflows: 1. Input preprocessing (padding). 2. Iterative function application. 3. Finalization. Use cases: Data deduplication, Load balancing (consistent hashing), Digital signatures.

        graph LR
  Center["Hashing"]:::main
  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

Imagine you have a giant LEGO castle. If you take a picture of exactly how it looks from the top, that photo is like a '[hash](/en/terms/hash)'. If you change just one LEGO [block](/en/terms/block), the next photo will look different. You can't rebuild the whole castle just by looking at the photo, but you can use the photo to prove that nobody touched your castle while you were gone.

🤓 Expert Deep Dive

Technically, hashing involves the application of a 'Compression Function' (like the Merkle-Damgård construction) to map an infinite input space into a finite output space. For 'Data Integrity', we use fast hashes like CRC32. For 'Passwords', we use slow, compute-intensive hashes like 'Argon2' or 'bcrypt', combined with 'Salting' (adding random data to the input) to prevent 'Rainbow Table' attacks. In 'Blockchain', hashing is the core of the 'Proof of Work' mechanism and the 'Chain of Integrity' where each block's header contains the hash of the preceding block, creating an immutable cryptographic link.

📚 Sources