2. CYBER SECURITY PRESENTATION
Cryptography
MD5
Symmetric Key Cryptography
Same Private key is used for encryption and
decryption.
Asymmetric Key Cryptography
Public key used for encryption and another,
different Private key is used for decryption
3. CYBER SECURITY PRESENTATION
Authentication
MD5
If A is the sender of a message and B is the
receiver, A encrypts the message with A’s private
key and sends the encrypted message to B.
This scheme does not achieve confidentiality, it
achieves authentication (identifying and proving
A as the sender).
This achieves the purpose of non-repudiation. B
can take the encrypted message, and decrypt it
with A’s public key to prove that the message
indeed came from A.
4. CYBER SECURITY PRESENTATION
Message Digest
MD5
We perform a hashing operation (or a message digest
algorithm) over a block of data to produce its hash or
message digest which is smaller in size than the original
message.
MD5 is a message-digest algorithm developed by Ron Rivest.
It has its roots in a series of message-digest algorithms,
which were the predecessors of MD5, all developed by Rivest.
In real practice, a more efficient scheme for Authentication is
used. It involves the usage of a message digest (also called
hash).
5. CYBER SECURITY PRESENTATION
Properties
MD5
Given a message, it should be very easy to
find its corresponding message digest. Also,
for a given message, the message digest
must always be the same
7. CYBER SECURITY PRESENTATION
Properties
MD5
Given a message, it should be very easy to
find its corresponding message digest. Also,
for a given message, the message digest
must always be the same
9. CYBER SECURITY PRESENTATION
Steps
MD5
01
The first step in MD5 is to add padding bits to the original message to make the length of the original
message equal to a value, which is 64 bits less than an exact multiple of 512.
For eg., it could be 448 bits (512-64), 960 bits ((2 x 512) - 64), 1472 bits ((3 x 512) - 64), etc.
Padding is always added, even if the message is already a multiple of 512.
10. CYBER SECURITY PRESENTATION
The length of the message is
calculated, excluding the padding bits
(length before the padding bits).
If the original message consisted of
1000 bits, and we added a padding of
472 bits to make the length of the
message 64 bits less than 1536 (a
multiple of 512).
Steps
MD5
02
Next step is to calculate the original length of the message, and add it to the end of the message, after padding.
Length of the original message is now expressed as a 64-bit value, and these 64 bits are appended to the end of the original message +
padding. If the length of the message exceeds 264
bits, we use only the low-order 64 bits of the length. That is, in effect, we calculate the
length mod 264
in that case. Length of the message is now an exact multiple of 512
11. CYBER SECURITY PRESENTATION
Steps
MD5
03
Divide the input message into
blocks, each of length 512 bits.
Steps
MD5
04
Four variables (called chaining variables) are initialized. They are
called A, B, C and D. Each of these is a 32-bit number. The initial
hexadecimal values of these chaining variables are shown
12. CYBER SECURITY PRESENTATION
Steps
MD5
05
There is a loop that runs for as many 512-bit blocks as
are in the message. Copy the four chaining variables
into four corresponding variables, a, b, c and d. Thus, we
now have a = A, b = B, c = C and d = D.
The algorithm considers the combination
of a, b, c and d as a 128-bit single
register. This register (abcd) is useful in
the actual algorithm operation for
holding intermediate as well as final
results.
13. CYBER SECURITY PRESENTATION
Divide the current 512-bit block into 16 sub-blocks. Thus, each sub-block contains 32 bits.
There are four rounds. In each round, we
process all the 16 sub-blocks belonging to a
block.
The inputs to each round are (a) all the 16
sub-blocks, (b) the variables a, b, c, d, and (c)
some constants, designated as t.
14. CYBER SECURITY PRESENTATION
Working
MD5
In each round, we have 16 input sub-blocks, named
M[0], M[1], …, M[15], or in general, M[i], where i varies
from 1 to 15. Each sub-block consists of 32 bits.
t is an array of constants. It contains 64 elements, with
each element consisting of 32 bits. We denote the
elements of this array t as t[1], t[2], … t[64], or in general
as t[k], where k varies from 1 to 64. Since there are four
rounds, we use 16 out of the 64 values of t in each round.
A process P is first performed on b, c and d. This process
P is different in all the four rounds.
The variable a is added to the output of the process P
(i.e. to the register abcd).
The message sub-block M[i] is added to the output.
The constant t[k] is added to the output.
The output is circular-left shifted by s bits.
The variable b is added to the output and this output
becomes the new abcd for the next step
15. CYBER SECURITY PRESENTATION
Working
MD5
We can mathematically express a single MD5
operation as:
a = b + ((a + Process P (b, c, d) + M[i] + T[k]) <<< s)
Where,
a, b, c, d = Chaining variables.
Process P = A non-linear operation.
M[i] = M[q ¥ 16 + i], which is the ith 32-bit word in
the qth 512-bit block of the message
t[k] = A constant, as discussed subsequently
<<<s = Circular-left shift by s bits