What is Hash Function?
A mathematical function that converts any input data into a fixed-size string of characters (hash). Cryptographic hash functions are one-way, meaning you cannot reverse the process to recover the original data.
Also known as: Cryptographic Hash, Message Digest, Checksum
A hash function takes any input—a password, a file, an entire database—and produces a fixed-length "fingerprint." Change one bit of the input, and the entire hash changes dramatically.
Key Properties
One-Way (Pre-image Resistance)
- Given a hash, you can't find the original input
- The only way is to guess and check
Deterministic
- Same input always produces same hash
- Essential for verification
Collision Resistance
- Extremely hard to find two inputs with the same hash
- Critical for security
Avalanche Effect
- Tiny input change = completely different hash
- No pattern to exploit
Common Hash Functions
| Algorithm | Output Size | Status |
|---|---|---|
| MD5 | 128 bits | Broken - don't use |
| SHA-1 | 160 bits | Weak - being phased out |
| SHA-256 | 256 bits | Secure - widely used |
| SHA-3 | Variable | Secure - newer standard |
| BLAKE2 | Variable | Secure - very fast |
Use Cases
Password Storage
- Never store passwords in plaintext
- Store hash instead
- Verify by hashing input and comparing
File Integrity
- Download a file, compare hash
- If hashes match, file wasn't corrupted/tampered
Digital Signatures
- Hash the document
- Sign the hash (much smaller than document)
Blockchain
- Each block contains hash of previous block
- Tampering breaks the chain
What Hashing Is NOT
- Not encryption: Can't be reversed
- Not for hiding data: Anyone can hash and compare
- Not perfect: Collisions theoretically possible (just computationally infeasible)
Related Terms
Encryption
The process of converting information into a code to prevent unauthorized access. Encryption transforms readable data (plaintext) into an unreadable format (ciphertext) using a cryptographic algorithm and key. Only those with the correct key can decrypt and read the original data.
Password Manager
Software that securely stores and manages passwords and other credentials. Password managers generate strong, unique passwords for each account and encrypt them with a single master password, eliminating password reuse and the need to remember multiple complex passwords.
SHA-256
A cryptographic hash function that produces a 256-bit (32-byte) hash value. Part of the SHA-2 family, it's widely used for data integrity verification, digital signatures, password hashing, and as the backbone of Bitcoin's proof-of-work.
Have more questions?
Use our guided flow to get the right next privacy step for Hash Function.
Open Guided Flow