H
Hashing
Hashing is a one-way function that converts data into a fixed-length string, used for password storage and data integrity.
What is Hashing?
Hashing applies a mathematical function to convert input data into a fixed-size output (hash or digest). It's one-way—you cannot recover the original data from the hash.
Hash Properties
- Deterministic: Same input always produces same output
- Fixed Output: Any input produces fixed-length hash
- One-Way: Cannot reverse the hash
- Collision Resistant: Hard to find two inputs with same hash
Common Hash Algorithms
- MD5: 128-bit, broken (don't use)
- SHA-1: 160-bit, weak (avoid)
- SHA-256: 256-bit, general purpose
- SHA-3: Modern alternative
- bcrypt/Argon2: For passwords
Common Misconceptions
- "MD5 is still secure" - Broken, don't use
- "Hashing and encryption are the same" - Fundamentally different
- "SHA-256 is good for passwords" - Use bcrypt/Argon2 instead