Hashing is a concept in which, when we give data of an arbitrary size to a function, we get a small simplified value. This function is called a hash function. Hashing uses a hash function that maps the given data to another range of data, so that a new range of data can be used as an index in the hash table. More specifically, we will use hashing to convert strings into integers. In our discussions in this chapter, we are using strings to convert into integers, however, it can be any other data type which can be converted into integers. Let's look at an example to better understand the concept. We want to hash the expression hello world, that is, we want to get a numeric value that we could say represents the string.
We can obtain the unique ordinal value of any character by using the ord() function. For example, the ord('f') function gives 102. Further...