Hashing Algorithm



Hashing refers to a string of characters being converted into a typically shorter fixed-length value or key that represents the original string. Hashing is useful for indexing and retrieving objects in a database, since it takes less time to find the object using the shorter hashed key compared to the time taken while using the original value. Hashing is also used in many algorithms for the encryption.

The hashing algorithm is called the hash function: a name probably derived from the assumption that the resulting hash value can be taken as a variant of the specified value that is “mixed up.”

Hashing techniques

There are three basic methods for dealing with a hash conflict. They are as follows:

  • Chaining
  • Rehashing
  • Separate chaining


This hashing technique constructs a link list of all objects whose keys have the same value. This ordered linked list is traversed sequentially during a quest from the desired key. It involves adding an additional connection field to the location of each table. There are three coupling types:

General Coalesced Hashing

This is a generalization of the standard method of coalesced chaining. In this process, extra positions are added to the hash table which can be used in the time of collision to list the nodes.

Standard Coalesced Hashing

That is considered the simplest of all methods of chaining. For an ineffective search it brings down the average number of probes. It also performs the deletion without having any adverse effects on effectiveness.

Varied Insertion Coalesced Hashing

This form of chaining is the combination of a coalesced general and regular hashing. In this method the colliding item is inserted into the list immediately after the hash position, unless there is a cellar element in the list emerging from that position.


This hashing technique involves the use of a secondary hash function. The rehash function is applied successively until the table where an element can be inserted has an empty location found. The rehash function is again used to locate the object if the object ‘s hash location is found to be occupied during the search.

Separate Chaining

Items can’t be inserted more than table size. In some cases, space is allocated much more than required which leads to wastage of space. A method called separate chaining for solving collisions is available to handle these problems. This hashing technique maintains a separate list of links for all records whose keys have a given value. As part of this method, the items ending with a specific number is placed in a particular link list. It doesn’t take into account the 10’s and 100’s. The pointer to the node points to the next node, and in cases where no more nodes remain, the pointer points to the NULL value. A few key advantages of this distinct chaining method include:

  • The list items need not be stored in contiguous form
  • This allows the passage of objects in hash key order
  • Need not to worry about filling up the table no matter how many items.

What is Salting?

This salting term usually relates to the hashing of passwords. For create a different hash value, it is simply a unique value that can be added to the end of the password. This in fact adds a layer of safety to the hashing process , particularly against attacks by brute force. A brute force attack is one in which a device or botnet attempts any combination of numbers and letters until it finds the password. In addition, the extra value is referred to as a “salt” when salting. The idea here refers to the fact that you have actually complicated the password cracking process by adding a salt to the end of a password, and then hashing it.