Hashing and Keys
Hashing is related to encryption but serves a different purpose: verifying that data hasn't changed, rather than hiding it.
What You'll Learn
- What hashing is
- How hashing differs from encryption
- A common use for hashing
What Hashing Does
Hashing takes data of any size and produces a fixed-length string called a hash. Unlike encryption, hashing is a one-way process -- there's no key to reverse it back to the original data.
Why It's Useful
Because even a tiny change to the original data produces a completely different hash, hashing is commonly used to verify that data hasn't been altered, and to store passwords without keeping the actual password.
Example
A downloaded file's hash can be compared to the hash published by the file's source -- if they match exactly, the file wasn't corrupted or tampered with during download.
Key Concepts
Key Takeaways
- Hashing produces a fixed-length hash from data of any size
- Hashing is one-way, unlike encryption which can be reversed with a key
- Hashing is commonly used to verify data integrity and store passwords safely
Knowledge Check
What is a key difference between hashing and encryption?