Download as pdf or txt
Download as pdf or txt
You are on page 1of 25

Secure hash function

Chapter 05
Information Authentication

 Message authentication: ensure that the information


content is not changed during the exchange between
two entities.
 Origin of information authentication (peer
authentication): ensure that the partner that is
exchanging data is a valid partner.

2
Information authentication techniques

 Using cryptography techniques: only the valid


partner has the key to decrypt the information.
 Using the MAC (Message Authentication Code).
 Using secure hash functions.

3
Authentication using cryptography

4
Authentication using cryptography

5
Authentication using MAC

•The MAC is generated using CBC (Cipher Block


Chaining) called CMAC.
•MACs are generated from hash functions called HMACs.
6
Cipher Block Chaining MAC

7
Authentication using secure hash functions

8
One-way hash function

 Transforms the original information block of any


length into a fixed-length block of information called
a hash code (hash code or message digest).
 Hash function can only be used to generate hash code
from original information without doing the
opposite => one way hash function

9
Operations of hash function

10
Simple hash function
 The original information is the sequence of
characters in the Latin alphabet: A, B, C, …, Z
 The letters are numbered from 1…26
 Representation of original information:
M={m1, m2, …, mn}
 Hash function:
H(M)=1 + (m1 + m2 +…+mn) mod 26

11
Simple hash function

 For original information: “Hello world”


 M = {8, 5, 12, 12, 15, 23, 15, 18, 12, 4}
 H(M) = 1 + (8 + 5 + 12 + 12 + 15 + 23 + 15 +
18 + 12 + 4) mod 26 = 21
 => H(M) = U.

12
Requirements for the H hash function

 H can be applied to information blocks of any length.


 The result of the function H always has a fixed
length.
 The calculation of H(M) with any information block
M must be simple, fast, and can be done by software
and hardware.

13
Attributes of the hash function

 One-way attribute: Given m, cannot find M


satisfying H(M)=m.
 Weak collision resistance: Given M, cannot find M’
 M satisfying H(M) = H(M’)
 Strong collision resistance: Can't find a pair M and
M’ satisfying H(M) = H(M’)

14
Attack hash functions

 The goal of the attack is to create conflict situations


(weak or strong).
 The security of a hash function depends on the size of
the hash.
 The Birthday problem is often used to calculate
the security of a hash function.

15
Secure Hash Algorithm (SHA)

16
Operations in SHA_1
SHA-1 accepts information blocks with a maximum
size of 264 bits to generate a 160-bit fixed-length
hash. The entire information block is processed in
512-bit blocks, through 5 stages as follows:
 Append padding bits: make the original
information = 448 modulo 512 bits. That is, all
previous blocks are of equal length 512 bits, except
the last block is 448 bits. The principle of padding
is to add a 1_bit to the end of the bit string, then
attach an enough bit sequence of 0s to form a
block of 448 bits.
17
Operations in SHA_1
 Append length: A 64-bit string is appended to the
information block, indicating the length of the
original information block, in bits. Result:
information block is a multiple of 512, divided into
groups. Each group of 16 registers 32bit:
16*32=512bit

18
Operations in SHA_1
 Initialize MD buffer: MD (message digest)
buffer is a 160-bit memory used to hold the
intermediate and final results of the hash. This
memory is organized into five 32-bit registers
and is initialized to the following values (Hex):
 A = 67452301
 B = EFCDAB89
 C = 98BADCFE
 D = 10325476
 E = C3D2E1F0

19
Operations in SHA_1
 Process information in blocks:
➢is the central stage of the hash function,
also known as the compression function,
consisting of 4 rounds, 20 steps each.
➢All four rounds have the same structure, but
each round uses a different logic function f1,
f2, f3 and f4

20
Processing
information
in SHA_1

21
Output: After all 512-bit blocks
have been processed, the output
of the last step is the value of the
hash code.

22
MD5 Hash Algorithm

 Commonly used before, less secure than SHA_1


 MD5 is an information authentication algorithm that
has been widely used in recent times in the Internet
community, especially used to check the accuracy of
open source software released on the network.

23
Exercise

 A hash function generates a hash code of size 12 bits.


Determine the number of strong collisions that can
occur when trying 210 different original messages?

24
Exercise

 A choose X, encrypt by key K and send C to B.


 B choose Y, then receive key K from A to compare
X with Y.
 Is there a way to fake the information in this
situation?

25

You might also like