You are on page 1of 14

Message Integrity

Hash Function
A cryptographic hash function is a hash function; that is, an
algorithm that takes an data block of any length and returns a
fixed-size bit string (output), the hash value. Any accidental or
intentional modifications to the original data will change the hash
value. The data to be encoded are often called the "message,"
and the hash value is sometimes called the message digest or
simply digest.
The cryptographic hash function has following properties:
it is easy to compute the hash value for any given
message
Usually hash functions are publically available for use
Hash functions does not use a key
condenses a variable-length message M to a fixed sized
fingerprint (Hash value)
It is infeasible to modify a message without changing the
hash
It is infeasible to generate a message that has a given
hash (Preimage resistance) one way
It is infeasible to find two different messages with the
same hash (Collision resistance)

Hash Function
Cryptographic hash functions have many information security
applications, notably in digital signatures.

MD5 and SHA-1 most widely used hashes along with RIPEMD-160
and SHA-2.

The MD5 Message-Digest Algorithm is a widely used cryptographic
hash function that produces a 128-bit (16-byte) hash value. MD5 has
been utilized in a wide variety of security applications, and is also
commonly used to check data integrity. MD5 was designed by Ron
Rivest in 1991 to replace an earlier hash function, MD4.

SHA-1 A US government standard (similar to MD5) and
produces160 bit output




Hash Function
Hash Function
Message Authentication Code
(MAC)
MAC
Algorithm
Plain
Text
Key
MAC
Message Authentication Code
(MAC)
An algorithm that creates a small fixed-
sized block
depending on both message and some key
Not reversible
Can be appended to message as a
signature
Receiver performs same computation on
message and checks it matches the MAC
Provides assurance that message is
unaltered and comes from sender
Message Authentication Code
(MAC)
Generates a small fixed-sized block of data
Based on message + secret key
MAC = C(K,M)
appended to message when sent

The MAC value protects both a message's data
integrity as well as its authenticity, by allowing
verifiers or receiver (who also possess the secret
key) to detect any changes to the message content.
Message Authentication Code
(MAC)
Message Authentication Code
(MAC)
As illustrated the MAC provides authentication
can also use encryption for secrecy
generally use separate keys for each
can compute MAC either before or after encryption
is generally regarded as better done before
why use a MAC?
sometimes only authentication is needed
sometimes need authentication to persist longer than
the encryption (eg. archival use)
Note that a MAC is not a digital signature
Message Authentication Code
(MAC)
Requirements for MACs
Taking into account the types of attacks, MAC need
to satisfy the following:
1. knowing a message and MAC, is infeasible to find
another message with same MAC
2. MACs should be uniformly distributed
3. MAC should depend equally on all bits of the
message
Message Authentication Code
(MAC)
Keyed Hash Functions as MACs
Design MAC algorithm based on a hash
function
Because hash functions are generally faster
Cryptographic hash function code is widely available
Therefore design a hash to includes a key
along with message as the input
original proposal: KeyedHash = Hash(Key|Message)
But some weaknesses were found with this

So, Eventually led to development of HMAC
HMAC Design Objectives
To use , hash functions without modifications
Allow for easy replaceability of already embedded
(currently in use) hash functions
Preserve original performance of hash function
without significant degradation
Use and handle keys in a simple way.
To allow any hash function to be used
eg. MD5, SHA-1, RIPEMD-160, Whirlpool

You might also like