In the context of this exercise, introducing hash functions, what are some reasons that hash functions should not be reversible?
There are many reasons why hash functions should not be reversible, and some of the main reasons are because of security, uniqueness, and because it just might not be possible.
The first reason why hash functions should not be reversible is that of security reasons. In areas such as cryptography, it is important to generate encrypted passwords or data, without a way to decrypt them. If the functions used were reversible, then there would be a lot of security issues.
The next reason is that if hash functions were reversible, it somewhat implies that every key-value pair must be unique. Values don’t have to be unique, but if each value can give us a unique key by reverse hashing it, then the values themselves must be unique along with their keys. For example, email addresses are unique, but names associated with them are not. With a reversible hash, the same name must map to just one specific email, which is not possible.
The impossibility of a reversible hash is also because, if they were reversible, then compression would be immensely improved. We can simply hash every piece of data to the compressed form because we can just reverse hash it to obtain all the original data. Again, this is not really possible as values are not always unique.