What Is Hashing | Is It Really Safe?

Hashing is a concept that bears a lot of importance not only in the computing world but also in our day to day lives. This beautiful mathematical property allows for us to keep our communications and data secure. It also makes data lookup faster by referencing the hash of the data rather than the original data itself.

How Hashing works

Hashing is a technique that is used to take in a value in say bits and churn out a seemingly random output of a fixed length.This property is used in many ways to provide different functionality in many different use cases. You can try out how a hashing algorithm works here.

Hash Tables

Hash tables are utilized to reduce lookup times in a database. The data is put through a hash function and the corresponding hash of that data is taken and stored. The hash of that data then points to the data itself which is stored separate from the hash values.

hashfunction

If we need to find a certain data say a username or password then we take the input given by the user, hash it with the hash function and then compare the output hash with the hash table entries to find the correct hash and then travel to the data it maps.

Hashing, when it comes to passwords also adds a layer of security as the password’s hash alone needs to be stored in servers for lookup. But this isn’t the optimal solution. If two users choose to have the same password then the same hash is generated twice which then leads to a collision. One way of solving this is by somehow incorporating the username of the user so that a unique hash is generated.

In order to increase security and prevent against dictionary attacks a process known as salting is performed wherein an extra couple of bits are put into the mix of the data prior to hashing so as to create another layer of complexity for anyone trying to brute force the system. New salts have to be produced for each new password so as to ensure secure storage.

Data Integrity

Integrity of data can be checked very easily using a hash function. When a file is delivered from a certain source and it comes with its hash, we can check very easily if the data has arrived in its entirety or without any tampering by comparing the hashes. If the provided hash matches the hash that we calculated with the received data we can be sure that the data has transmitted securely without any tampering.

This talks about a very important property of hash functions. Even if the input data is slightly changed the hash becomes something entirely different. This is how the Torrent protocol ensures the integrity of the transmitted data. The hash in this case also carries some other information but is majorly used to ensure integrity. If you would like to know more check it out here.

Digital Signature & Proof of Work

Since hash functions have the property of being unique they can be used as a signature or a digital signature. This usually ties into how the public and private key encryption work providing authenticity as well as security through a non secure channel.

In case of Bitcoin digital signatures are utilized to sign a transaction wherein it will be verified again before it is put into the blockchain. This technically prevents the issue of double spending and also proves ownership of the token or Bitcoin. You can learn more here.

digital signature

Hashing Algorithms

There are many different types of hash functions the industry as of now is at SHA2 coming from the earlier SHA1,MD5 and other similar implementations.

In order to understand why we need newer hashing functions we can take a look at a simple analogy. Consider there are unlimited pairs of shoes and only a limited number of racks to hold them. Therefore at some point we must start putting multiple shoes into the same rack. Same is the case here with hash functions, since the output is over a specified range there is only a certain number of permutations until which a unique hash is produced for every piece of data. If the hashes do start to overlap then the use of hash functions becomes irreverent. Similar hashes can be brought about by two different files, losing the ability of being unique indicator and also the ability to prove integrity of data.

As the quantity of data increases we must ensure that the hashing algorithms do not provide overlapping hashes hence the quest to always find newer hashing algorithms.

Hashing algorithms are an integral part of our day to day lives providing us with secure channels to transmit data through encryption, allowing us to hold assets via crytocurrency, ensure data integrity and also increase data lookup speeds. Meaning in this day and age hashing algorithms play a very pivotal role, and advancements in this field of study are more of a necessity than an option.

Leave a Reply

Your email address will not be published. Required fields are marked *