What is Hashing?

The technique of transforming a given key into another value is known as hashing. A mathematical algorithm is employed to generate the new value using a hash function.
May 23rd 2022.


The technique of transforming a given key into another value is known as hashing. A mathematical algorithm is employed to generate the new value using a hash function. The result of a hash function is known as a hash value or, simply, a hash.

The most common use of hashing is the creation of hash tables. A hash table keeps key-value pairs in a list that may be accessed using its index. The hash function will map the keys to the table size since key and value pairs are limitless. The hash value then determines the index for a specific element.


Hashing is the conversion of a given key into a smaller value that may be retrieved in O(1) time. This is accomplished by using a function or method known as a hash function to translate data to an encrypted or simplified representative value known as a "hash code" or "hash." This hash is then used as an index to narrow down search parameters and swiftly retrieve data.


Security: When we use a website for the first time, and it needs us to authenticate using "Sign Up," where we input our credentials to access accounts that belong to us, we must be certain that our account will not fall into the wrong hands. As a result, the password entered is saved in the database as a hash. This is done to prevent our sensitive information from falling into the wrong hands.

Tokenisation: hashing may be extended to tokenisation for keeping authorization tokens of users who have already logged into systems.

Data Structures: Hashing is often used in programming languages to define and build data structures. HashMap in Java, unordered map in C++, and so on.

Compiler development: Compilers for programming languages keep all of the keywords (such as if, else, for, while, return, and so on) that are used by that language in the form of a hash table so that the compiler can quickly determine which keywords need to be compiled during the compilation process.


After storing a large amount of data, we need to perform various operations on this data. For datasets, lookups are unavoidable. Lookups/searches using linear and binary search have time complexity of O(n) and O(log n), respectively. These difficulties rise dramatically as the amount of the dataset grows, which is unacceptable.

We require a technique that is independent of data size. Hashing allows lookups to take place in constant time, i.e. O(1)


In cyber security, unidirectional procedures using a one-way hashing technique are required. It is an important step in preventing threat actors from reverting a hash to its original state. Two keys can yield an identical hash at the same moment. This phenomenon is called a collision.

From two separate inputs, a good hash function never outputs the same hash value. As a result, a hash function with a minimal chance of colliding is considered acceptable.

When collisions occur, open addressing and independent chaining are two options for dealing with them. Open addressing avoids collisions by putting all data in the hash table and searching for availability in the algorithm's next place.

Open addressing methods include:

  • double hashing
  • linear probing
  • quadratic probing


Hashing is used in several encryption techniques to improve security. Without a decryption key, hashed text and inputs are useless to hackers.

For example, if hackers break into a database and uncover information like a user's name and account details, they can utilize it right away for their illegal activities. A hashed value like "a87b3," on the other hand, is worthless to threat actors unless they have a key to decode it.

As a result, hashing aids in securing passwords stored in a database.

What is BugBase?

BugBase is a curated marketplace for ethical hackers that helps businesses and startups set up bug bounty programs. It is India's first consolidated bug bounty platform, which assists organizations in staying safe by providing an all-in-one platform for continuous and comprehensive security testing.

Through BugBase registering and setting up your organisation’s bug bounty program is no less than a breeze. We also provide hackers and security professionals with the platform to directly get connected with organizations that have set up their bug bounty programs and get rewarded for the risks and vulnerabilities they find.

Thank you for being part of our BugFam! Stay up to date on our latest posts and hope you had a great week!

Join our discord community for regular updates and much more fun!!

Let's take your security
to the next level