Hash Function
PronunciationHASH FUNK-shun
Definition
A hash function turns any input into a fixed-size value (the hash). The same input always gives the same hash, and a good function spreads different inputs widely.
Where you hear it
In dictionaries and sets, checksums, password storage, caches and security discussions.
Examples
A dict uses a hash function to find the slot for each key.
Two inputs with the same hash are a collision.
The cache uses a hash function to turn each URL into a short key.
Common mistake
Using a fast hash like MD5 for passwords or security. Pick a purpose-built, slow, salted one for passwords.
Don't confuse with
Encryption, which can be reversed with a key. A hash is one-way.
Say it at work
- In a meeting or chat
What hash function does this use?
- In an email or ticket
Compare the file hashes to check integrity.
Keep exploring
More in Programming Fundamentals