Hash features are incredibly useful and appear in almost all info security applications.

You are watching: What characteristics are needed in a secure hash function?

A hash function is a mathematical function that switch a numerical input worth into one more compressed number value. The input come the hash function is of arbitrarily length yet output is constantly of solved length.

Values went back by a hash function are called message digest or merely hash values. The following picture illustrated hash function −


Features the Hash Functions

The common features the hash features are −

Fixed size Output (Hash Value)

Hash function coverts data the arbitrary length to a resolved length. This procedure is regularly referred to as hashing the data.

In general, the hash is lot smaller 보다 the entry data, hence hash features are sometimes dubbed compression functions.

Since a hash is a smaller depiction of a bigger data, the is likewise referred to together a digest.

Hash function with n little bit output is referred to as an n-bit hash function. Popular hash features generate values between 160 and 512 bits.

Efficiency of Operation

Generally for any kind of hash duty h with input x, computation the h(x) is a rapid operation.

Computationally hash attributes are much much faster than a symmetric encryption.

Properties of Hash Functions

In stimulate to be an efficient cryptographic tool, the hash role is desired to possess complying with properties −

Pre-Image Resistance

This property means that it have to be computationally tough to turning back a hash function.

In other words, if a hash function h produced a hash value z, climate it should be a daunting process come find any kind of input worth x that hashes to z.

This home protects against an attacker who only has actually a hash value and is make the efforts to discover the input.

Second Pre-Image Resistance

This property method given an input and its hash, it have to be tough to find a various input through the exact same hash.

In other words, if a hash duty h because that an intake x produce hash worth h(x), then it should be daunting to find any kind of other input value y such the h(y) = h(x).

This residential property of hash duty protects against an attacker who has actually an intake value and its hash, and also wants to substitute different value together legitimate worth in place of original input value.

Collision Resistance

This property way it have to be tough to discover two various inputs of any kind of length that an outcome in the exact same hash. This residential or commercial property is also referred to as collision cost-free hash function.

In various other words, for a hash role h, the is hard to find any type of two various inputs x and also y such that h(x) = h(y).

Since, hash duty is compressing duty with solved hash length, it is impossible for a hash duty not to have collisions. This home of collision cost-free only confirms the these collisions need to be hard to find.

This home makes the very complicated for an attacker to discover two entry values v the same hash.

Also, if a hash role is collision-resistant then the is 2nd pre-image resistant.

Design of Hashing Algorithms

At the heart of a hashing is a mathematical duty that operates on two fixed-size block of data to create a hash code. This hash function forms the component of the hashing algorithm.

The dimension of every data block varies depending on the algorithm. Frequently the block sizes room from 128 bits come 512 bits. The following illustration demonstrates hash duty −


Hashing algorithm entails rounds of above hash duty like a block cipher. Every round take away an intake of a solved size, generally a combination of the many recent message block and the calculation of the critical round.

This procedure is recurring for as plenty of rounds together are required to hash the entire message. Schematic the hashing algorithm is illustrated in the following illustration −


Since, the hash worth of first message block becomes an input come the 2nd hash operation, output of which alters the result of the third operation, and so on. This effect, known as an avalanche impact of hashing.

Avalanche effect results in substantially different hash values for two messages that differ by also a solitary bit of data.

Understand the difference between hash role and algorithm correctly. The hash role generates a hash code by operation on 2 blocks the fixed-length binary data.

Hashing algorithm is a procedure for making use of the hash function, specifying just how the article will be damaged up and how the outcomes from previous blog post blocks are chained together.

Popular Hash Functions

Let us briefly see some well-known hash functions −

Message Digest (MD)

MD5 was most popular and also widely offered hash role for quite some years.

The MD family members comprises of hash functions MD2, MD4, MD5 and MD6. It was embraced as net Standard RFC 1321. The is a 128-bit hash function.

MD5 digests have actually been widely used in the software people to carry out assurance around integrity of transferred file. Because that example, file servers often provide a pre-computed MD5 checksum because that the files, so that a user have the right to compare the checksum of the downloaded document to it.

In 2004, collisions were discovered in MD5. An analytical attack was report to be successful only in one hour through using computer system cluster. This collision strike resulted in compromised MD5 and also hence that is no much longer recommended because that use.

Secure Hash function (SHA)

Family the SHA comprise of four SHA algorithms; SHA-0, SHA-1, SHA-2, and also SHA-3. Though from exact same family, there room structurally different.

The initial version is SHA-0, a 160-bit hash function, was published by the national Institute of criter and modern technology (NIST) in 1993. That had few weaknesses and did no become very popular. Later on in 1995, SHA-1 to be designed to correct alleged weaknesses of SHA-0.

SHA-1 is the many widely provided of the currently SHA hash functions. That is employed in numerous widely offered applications and protocols including Secure Socket class (SSL) security.

In 2005, a method was found for uncovering collisions because that SHA-1 within practical time frame making long-term employability of SHA-1 doubtful.

SHA-2 family members has four further SHA variants, SHA-224, SHA-256, SHA-384, and SHA-512 escape up on variety of bits in their hash value. No successful assaults have however been reported on SHA-2 hash function.

Though SHA-2 is a strong hash function. Though significantly different, its simple design is still follows style of SHA-1. Hence, NIST dubbed for brand-new competitive hash function designs.

In October 2012, the NIST determined the Keccak algorithm together the new SHA-3 standard. Keccak offers many benefits, such as efficient performance and good resistance because that attacks.


The RIPEMD is one acronym for race Integrity Primitives Evaluation message Digest. This collection of hash functions was design by open up research community and generally well-known as a household of european hash functions.

The collection includes RIPEMD, RIPEMD-128, and also RIPEMD-160. There additionally exist 256, and 320-bit execution of this algorithm.

Original RIPEMD (128 bit) is based ~ above the design principles supplied in MD4 and also found to provide questionable security. RIPEMD 128-bit version came as a quick fix replacement to get over vulnerabilities on the initial RIPEMD.

RIPEMD-160 is an boosted version and also the most widely provided version in the family. The 256 and 320-bit versions reduce the chance of inadvertently collision, however do not have greater levels of defense as compared to RIPEMD-128 and RIPEMD-160 respectively.


This is a 512-bit hash function.

It is obtained from the modified version of progressed Encryption conventional (AES). One of the designer to be Vincent Rijmen, a co-creator of the AES.

Three version of Whirlpool have actually been released; namely WHIRLPOOL-0, WHIRLPOOL-T, and WHIRLPOOL.

Applications of Hash Functions

There room two direct applications the hash role based on its cryptographic properties.

Password Storage

Hash functions provide protection to password storage.

Instead of save on computer password in clear, greatly all logon processes store the hash worths of passwords in the file.

The Password document consists the a table of bag which space in the kind (user id, h(P)).

The procedure of logon is depicted in the following illustration −


An intruder deserve to only see the hashes the passwords, even if he accessed the password. He have the right to neither logon using hash nor have the right to he have the password from hash value because hash role possesses the home of pre-image resistance.

Data truth Check

Data integrity check is a most typical application the the hash functions. That is supplied to create the checksums on data files. This application offers assurance to the user about correctness that the data.

See more: A Metaphor About Someone Who Is Very Smart, Is This A Metaphor Or Simile

The procedure is depicted in the following illustration −


The integrity inspect helps the user to detect any type of changes made to initial file. That however, go not carry out any assurance about originality. The attacker, instead of modifying record data, can adjust the entire document and compute all together brand-new hash and also send to the receiver. This integrity check application is advantageous only if the user is sure about the originality the file.