Monday, February 3, 2020

Cryptography Hash functions

Hash functions are extremely useful and appear in almost all information security applications.
A hash function is a mathematical function that converts a numerical input value into another compressed numerical value. The input to the hash function is of arbitrary length but output is always of fixed length.
Values returned by a hash function are called message digest or simply hash values. The following picture illustrated hash function −
Hash Functions

Features of Hash Functions

The typical features of hash functions are −
  • Fixed Length Output (Hash Value)
    • Hash function coverts data of arbitrary length to a fixed length. This process is often referred to as hashing the data.
    • In general, the hash is much smaller than the input data, hence hash functions are sometimes called compression functions.
    • Since a hash is a smaller representation of a larger data, it is also referred to as a digest.
    • Hash function with n bit output is referred to as an n-bit hash function. Popular hash functions generate values between 160 and 512 bits.
  • Efficiency of Operation
    • Generally for any hash function h with input x, computation of h(x) is a fast operation.
    • Computationally hash functions are much faster than a symmetric encryption.

Properties of Hash Functions

In order to be an effective cryptographic tool, the hash function is desired to possess following properties −
  • Pre-Image Resistance
    • This property means that it should be computationally hard to reverse a hash function.
    • In other words, if a hash function h produced a hash value z, then it should be a difficult process to find any input value x that hashes to z.
    • This property protects against an attacker who only has a hash value and is trying to find the input.
  • Second Pre-Image Resistance
    • This property means given an input and its hash, it should be hard to find a different input with the same hash.
    • In other words, if a hash function h for an input x produces hash value h(x), then it should be difficult to find any other input value y such that h(y) = h(x).
    • This property of hash function protects against an attacker who has an input value and its hash, and wants to substitute different value as legitimate value in place of original input value.
  • Collision Resistance
    • This property means it should be hard to find two different inputs of any length that result in the same hash. This property is also referred to as collision free hash function.
    • In other words, for a hash function h, it is hard to find any two different inputs x and y such that h(x) = h(y).
    • Since, hash function is compressing function with fixed hash length, it is impossible for a hash function not to have collisions. This property of collision free only confirms that these collisions should be hard to find.
    • This property makes it very difficult for an attacker to find two input values with the same hash.
    • Also, if a hash function is collision-resistant then it is second pre-image resistant.

No comments: