Cryptographic Hash Function (Hash)

A cryptographic hash function is a special class of hash functions that map data of arbitrary size to a probabilistically unique bit string of a fixed size – the hash. What distinguishes a cryptographic hash function is that it is designed to be a one-way function, which means it is not practically possible to invert – i.e. take a hash and reproduce the input data used to create it.

Cryptographic hash functions have many applications, including digital signatures, message authentication codes (MACs), and other forms of authentication. They can also be used as ordinary hash functions, to index data in hash tables, for fingerprinting, to detect duplicate data or uniquely identify files, and as checksums to detect accidental data corruption.

Frequently Asked Questions
How does a cryptographic hash function work?

A cryptographic hash function must be able to process an arbitrary-length message into a fixed-length output. This can be achieved by breaking the input message into a series of equal-sized blocks, and operating on them in sequence using a one-way compression function. A one-way compression function is a function that transforms two fixed-length inputs into a fixed-length output. The compression function can either be specially designed for hashing or map from a block cipher.

What is the purpose of hashing?

Hashing maps data of arbitrary size to a probabilistically unique bit string of a fixed size. Hashing produces unique bit strings that represent the input data in a concise way.

Can hash be reversed?

A cryptographic hash function cannot be easily reversed. To reproduce the input data, an attacker must use computationally expensive brute force techniques to try to recover the input data that maps to a specific hash.

What is the usage of a cryptographic hash function?

Cryptographic hash functions provide unique and concise representations for the input data without revealing any information about the input data itself.

Is RSA a hash function?

RSA typically refers to a public-key cryptosystem which is widely used for secure data transmission. It uses paired keys where one is used to encrypt messages and the other to decrypt them. RSA is therefore not a hash function. That said, algorithms that use RSA crypto keys often use hashes to sign messages.

What is one way hash function?

A one-way hash function is one where computing a hash from the input data is easy, but inverting the computation – i.e. recovering the input data from the hash – is practically impossible.

What is the difference between weak and strong collision resistance?

Weak Collision Resistance means that given an arbitrary message m1, it is difficult to produce another message m2 such that H(m1)=H(m2).

Strong Collision Resistance means that is difficult to find any two messages that hash to the same value. That is, it is hard to find m1 and m2 such that H(m1)=H(m2).