Hashing with Hash Functions
Do you remember those secret codes you used as a kid to create and decipher messages? For example, here’s a simple way to map letters to numbers:
A = 1 B = 2 C = 3 D = 4 E = 5
and so on. According to this code,
ACE converts to 135, CAB converts to 312, DAB converts to 412,
and
BAD converts to 214.
This process of taking characters and converting them to numbers is known as hashing. And the code that is used to convert those letters into particular numbers is called a hash function.
Many other hash functions exist besides this one. Another example of a hash function may be to take each letter’s corresponding number and return the sum of all the numbers. If we did that, BAD would become the number 7 following a two-step ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access