Hashing : Applications

What is hashing? 

Hashing refers to the concept of taking an arbitrary amount of data as an input, applying some algorithms on it, and generating a fixed-size output called a hash.

In other words, hashing is the process of converting a given key into another value.

Now in this article, we will be more focused on applications of hashing.

There are numerous applications of hashing, Some of these applications are listed below: 

1) Data Structures (Programming):- 

Hashing is most commonly used to implement hash tables.

Hash tables are one of the most popular and widely used data structures that provides constant time i.e. O(1) search, insert and delete operations on average.

The most common examples are HashSet & HashMap in Java, unordered_set & unordered_map in C++, dict in python, and so on.

This is how values are placed in the hash table.

2) Data Encryption ( Password verification ) :-

When you use any online website which requires authentication. Then you create your account with the credentials like user name & password, once your account is created the password you entered is created into a hash value and saved on the server of the site. Now if suppose you again tried to log in to your account in the future then you just require your username and password. When the password is entered, The currently entered password is also converted into a hash and it is compared with the original hash of the password which is stored on the server of the website. A good hash function uses a one-way hashing algorithm, or in other words, the hash cannot be converted back into the original text. passwords are stored in the form of their hashes so that even if a database is breached, plaintext passwords are not accessible to any unauthorized person. 

3) Message Digest:-

The message digest is also a great application of cryptographic Hash Functions.

( A cryptographic hash function is an algorithm that takes an arbitrary amount of data as an input and produces a fixed-length output of encrypted text called a hash value ).

Cryptographic hash functions are the functions that produce an output such that reaching to original text or input with help of the output is almost impossible.

This property of hash functions is called irreversibility. Simply the hash is irreversible.

4) Rabin – Karp Algorithm:-

One of the most famous and widely used applications of hashing is the Rabin-Karp algorithm.

So basically the Rabin-Karp algorithm is a string or pattern in a string searching algorithm that uses hashing to find a particular set of patterns in a string. This algorithm is also called the plagiarism detecting algorithm. 

5) Map the Filename & Path:-

The operating system uses a map. map(file_name, file_path) which is implemented using a hash table.

In order to store the correspondence between file_name and file_path. Which helps to locate the files easily.

6) Compilers:-

To differentiate between the syntaxes like (if, else if, for, while, return, and so on.) used by various programming languages the compiler uses a set implemented based on a hash table to identify the difference between. 

Conclusion:- 

The application and uses of hashing are uncountable Because it has numerous applications.

So understanding the concept of hashing is important. As hashing plays a key role in many algorithms as well as in data security.

Special thanks to Abhishek Yadav for contributing to this article on takeUforward. If you also wish to share your knowledge with the takeUforward fam, please check out this article