As a programmer, you use hash functions every day. They’re used in databases to optimise queries, they’re used in data structures to make things faster, they’re used in security to keep data safe. Almost every interaction you have with technology will involve hash functions in one way or another.

Hash functions are foundational, and they are everywhere.

But what is a hash function, and how do they work?

In this post, we’re going to demystify hash functions. We’re going to start by looking at a simple hash function, then we’re going to learn how to test if a hash function is good or not, and then we’re going to look at a real-world use of hash functions: the hash map.