How Hash Functions Work
A cryptographic hash function is a one-way mathematical algorithm that transforms an arbitrary-length input into a fixed-length digest. "One-way" means it is computationally infeasible to reconstruct the original data from its hash — you can go from input to digest, but never back. This property is what makes hashing fundamentally different from encoding, which is always reversible.
Well-designed hash functions exhibit the avalanche effect: changing a single bit of the input flips roughly half the bits in the output. For example, hashing hello versus Hello with SHA-256 produces two completely unrelated 64-character hex strings. This ensures that similar inputs do not produce similar hashes, making it impossible to infer relationships between source data by comparing digests.
Hash output is always deterministic — the same input always yields the same hash — and fixed-length regardless of input size. A 1-byte file and a 10 GB file both produce a 256-bit digest with SHA-256. This fixed-size property is what enables constant-time comparison and efficient lookup in hash tables, Bloom filters, and integrity-checking workflows.