Monday 25 April 2011

Hashing


If you don't get everything you want, think of the things you don't get on time and things that you don't want. Hashing is nothing but a retrieval technique that gives you better and fast results and minimizes your time.   
Working with the large database, it is always a major demand to provide efficient retrieving and storing of data and information. For this purpose, many file organization techniques have already been developed. Hashing is one of the developed techniques.

Hashing is the transformation of a string of characters into a usually shorter fixed-length value or key that represents the original string. Hashing is used to index and retrieve items in a database because it is faster to find the item using the shorter hashed key than to find it using the original value. It is also used in many encryption algorithms.
As a simple example of the using of hashing in databases, a group of people could be arranged in a database like this: Abernathy, Sara Epperdingle, Roscoe Moore, Wilfred Smith, David.   
Each of these names would be the key in the database for that person's data. A database search mechanism would first have to start looking character-by-character across the name for matches until it found the match (or ruled the other entries out). But if each of the names were hashed, it might be possible (depending on the number of names in the database) to generate a unique four-digit key for each name. For example: 7864   Abernathy, Sara    9802   Epperdingle, Roscoe    1990   Moore, Wilfred    8822   Smith, David    (and so forth). A search for any name would first consist of computing the hash value (using the same hash function used to store the item) and then comparing for a match using that value. It would, in general, be much faster to find a match across four digits, each having only 10 possibilities, than across an unpredictable value length where each character had 26 possibilities.

The hashing algorithm is called the hash function (and probably the term is derived from the idea that the resulting hash value can be thought of as a "mixed up" version of the represented value). In addition to faster data retrieval, hashing is also used to encrypt and decrypt digital signatures (used to authenticate message senders and receivers). The digital signature is transformed with the hash function and then both the hashed value (known as a message-digest) and the signature are sent in separate transmissions to the receiver. Using the same hash function as the sender, the receiver derives a message-digest from the signature and compares it with the message-digest it also received. They should be the same.

The hash function is used to index the original value or key and then used later each time the data associated with that particular value or key is to be retrieved. Thus, hashing is always a one-way operation. There's no need to "reverse engineer" the hash function by analyzing the hashed values. In fact, the ideal hash function can't be derived by such analysis. A good hash function also should not produce the same hash value from two different inputs. If it does, this is known as a collision. A hash function that offers an extremely low risk of collision may be considered acceptable. In present information technology world many companies has lot of database servers placed globally and N- number of users access that data simultaneously so use of hashing is the better way to get response in very short time.

No comments:

Post a Comment