0% found this document useful (0 votes)
9 views

Cryptography Hash Functions

Uploaded by

Rahul Jain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Cryptography Hash Functions

Uploaded by

Rahul Jain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

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 −

Design of Hashing Algorithms


At the heart of a hashing is a mathematical function that operates on
two fixed-size blocks of data to create a hash code. This hash function
forms the part of the hashing algorithm.
The size of each data block varies depending on the algorithm.
Typically the block sizes are from 128 bits to 512 bits. The following
illustration demonstrates hash function –

Hash Function Structure


Hashing algorithm involves rounds of above hash function like a
block cipher. Each round takes an input of a fixed size, typically a
combination of the most recent message block and the output of the
last round.

This process is repeated for as many rounds as are required to hash


the entire message. Schematic of hashing algorithm is depicted in the
following illustration –
Hashing Algorithm
Since, the hash value of first message block becomes an input to the
second hash operation, output of which alters the result of the third
operation, and so on. This effect, known as an avalanche effect of
hashing.

Avalanche effect results in substantially different hash values for two


messages that differ by even a single bit of data.

Understand the difference between hash function and algorithm


correctly. The hash function generates a hash code by operating on
two blocks of fixed-length binary data.

Hashing algorithm is a process for using the hash function, specifying


how the message will be broken up and how the results from previous
message blocks are chained together.
Features of Hash Functions

The typical features of hash functions are −

• Fixed Length Output (Hash Value)


o Hash function coverts data of arbitrary length to a fixed

length. This process is often referred to as hashing the


data.
o In general, the hash is much smaller than the input data,

hence hash functions are sometimes called compression


functions.
o Since a hash is a smaller representation of a larger data, it
is also referred to as a digest.
o 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
o Generally for any hash function h with input x,

computation of h(x) is a fast operation.


o 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
o This property means that it should be computationally hard

to reverse a hash function.


o 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.
o This property protects against an attacker who only has a

hash value and is trying to find the input.


• Second Pre-Image Resistance
o This property means given an input and its hash, it should

be hard to find a different input with the same hash.


o 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).
o 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
o 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.
o 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).


o 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.
o This property makes it very difficult for an attacker to find

two input values with the same hash.


o Also, if a hash function is collision-resistant then it is

second pre-image resistant.

Application

Hash functions have many applications in computer science and


information security including:

1. Cryptography: These are used in cryptography to ensure the


confidentiality and integrity of data. They generate digital signatures,
which verify the authenticity of a message or document. Hash
functions also create message digests, ensuring data integrity during
transmission.
2. Data integrity checking: These verify that data has been unaltered
during transmission. This is done by generating a hash value for the
data before it is transmitted and another hash value for the data after it
has been received.
3. Data indexing: These create indexes for large data sets. This allows
for quick retrieval of data, even from extensive databases.
4. Data fingerprinting: These uniquely identify data, such as file-
sharing networks. Generating a hash value for a piece of data makes it
possible to identify and ensure it is uniquely safe.
5. Password storage: These store passwords securely. When a user
creates a password, the hash value of that password is stored instead
of the password itself.
6. Digital forensics: These are popular in digital forensics to ensure the
authenticity of evidence. Generating hash values for evidence makes
it possible to ensure the evidence is safe.
7. Blockchain: These are extensively popular in blockchain technology.
Each block in a blockchain contains a hash value of the previous
block, ensuring the entire blockchain’s integrity. Additionally, they
also mine new partnerships in a blockchain.

You might also like