Cryptographic Hashing Explained
In computer science, a hash function is any function that can be used to map data of arbitrary size to fixed-size values. In security, we use cryptographic hash functions.
Key Properties of a Good Hash Function
- Deterministic: The same input will always produce the exact same output.
- Quick to compute: It should be fast to generate the hash.
- Pre-image resistance (One-way): It should be computationally infeasible to reverse the process and figure out the original input from the hash output.
- Collision resistance: It should be highly improbable for two different inputs to produce the exact same hash output.
Passwords and Salting
Never store plaintext passwords. Instead, databases store the hash of the password. When a user logs in, the system hashes the password they typed and compares it to the stored hash.
To prevent attackers from using pre-computed "rainbow tables" to crack common passwords, developers add a Salt—a unique, random string added to the password before hashing.
You can generate hashes using various algorithms like SHA-256 and MD5 with our Hash Generator.