**What is Hashing?**

Hashing is a technique of getting a data faster whether it is stored in database or any data structure. Hash is value generated from any string , integer or file.It is generally smaller than itself.It is a mathematical concept of generating a hash function.Every time the hash function must generate a different hash value from previous one.So that sender and receiver process can be verified.If you are storing a string value into database or any data structure and you are using some hash value where it can be stored.When you are going to retrieve that value from database or DS then you have to use same hash function to get that value.Hashes are convenient for situations where computers may want to identify, compare, or otherwise run calculations against files and strings of data. It is easier for the computer to first compute a hash and then compare them than it would be to compare the original files.

Hashing algorithms are used in all sorts of ways – they are used for storing passwords, in computer vision, in databases.

One way that hash functions are used in computing is to check whether the contents of files are identical: as long as a hash function is secure, then two files which hash to the same value will always have the same contents.However, a hash collision occurs when two different files hash to the same value.

Here we only discuss about the SHA , its name gives away its purpose – it’s for cartographic security** (Cryptography is a method of storing and transmitting data in a particular form so that only those system or data structure for whom it is intended can read and process it.**). The Secure Hash Algorithm 1 (SHA-1) is a cryptography computer security algorithm.It was created by the US National Security Agency in 1995, after the SHA-0 algorithm in 1993, and it is part of the Digital Signature Algorithm or the Digital Signature Standard (DSS). The most important factors for cartographic hash algorithms is that they produce irreversible and unique hashes. Irreversible so that if you only had the hash you couldn’t use that to figure out what the original piece of data was, therefore allowing the original data to remain secure and unknown. Unique so that two different pieces of data can’t produce the same hash .

SHA1 is the version of SHA. SHA-1 is a **160-bit** hash. There are **2^160** possible outputs from which only one output can be generated. The SSL industry has picked SHA as their hashing algorithm for digital signatures. MD5 outputs an 128-bit hash value. Or: there are 2128 possible outputs.

The larger the number of possible hashes, the smaller the chance that two values will create the same hash.

Note that a large bit-length does not automatically mean a hashing algorithm produces secure hashes. The construction of the algorithm is also incredibly important

For example in **postgreSQL**

for **md5 **

1 |
select md5('1'); |

it will generate:

c4ca4238a0b923820dcc509a6f75849b

for **sha1**

1 |
select sha1('1'); |

it will generate:

356a192b7913b04c54574d18c28d46e6395428ab

**Where it can be used ?**

It can be used in secure applications like banking domains , educational domains or any other secure application.Usage of hash functions do not have performance issues.If you need something to be hashed quickly, or only need a 160 bit hash, you’d use SHA-1.

[/bg_collapse]

** **