Hash Function
A hash function maps input data to a value called a hash or digest. Cryptographic hash functions are designed to make reversing that mapping or finding matching outputs for different inputs computationally infeasible.
Zelf Core Team
What Is a Hash Function?
A hash function processes data and produces a value that represents it. In cybersecurity, this usually means a cryptographic hash function, such as SHA-256.
SHA-256 produces a 256-bit digest whether the input is a short message or a large file. The same input, processed by the same algorithm, always produces the same output.
Not every hash function is designed for security. Functions used for ordinary data organization may lack the properties required for cryptographic applications. NIST: Cryptographic Hash Function
How Does a Hash Function Work?
The algorithm transforms the input into a digest. A secure cryptographic hash function is designed to provide three important properties:
- Preimage resistance: Given a digest, finding an input that produces it should be impractical.
- Second-preimage resistance: Given one input, finding a different input with the same digest should be impractical.
- Collision resistance: Finding any two different inputs with the same digest should be impractical.
Collisions are mathematically possible because a fixed-length digest has a limited number of possible values. Security depends on making useful collisions infeasible to find—not on claiming they cannot exist.
Hashing is not encryption. There is no decryption key that restores the original input. However, predictable inputs can still be guessed and hashed for comparison. Password protection therefore requires purpose-built password hashing with salts and an appropriate computational cost, rather than a fast hash alone. NIST: Password Verifiers
Why Does a Hash Function Matter?
Hashes support integrity checks, digital signatures, and content-addressed storage.
For example, IPFS uses content identifiers built around cryptographic hashes. These help systems retrieve and verify content by its identity rather than relying solely on its location. An IPFS identifier includes structure and metadata; it is not necessarily the same as hashing the original file directly. IPFS: Content Identifiers
A matching hash can support an integrity check when the expected digest comes from a trusted source. It does not, by itself, establish who created the data or whether the data is safe.
For Zelf’s storage and privacy model, the distinction is essential: hashing helps identify or verify data, while encryption protects confidentiality. A hash is not a substitute for encrypting recovery information, and hashing personal information does not automatically make it anonymous.