Unit 4 Cryptography
Unit 4 Cryptography
Unit 4 Cryptography
Data Integrity
Unit: 4
•The course will cover the standard security protocols for user
authentication, key management and network security
*1= Low *2= Medium *3= High
Average
10
12/06/2023 Roshan Jameel Introduction to Cryptography and Information Security Unit 04
Question Paper Templet
2. https://youtu.be/Q-HugPvA7GQ
1. https://nptel.ac.in/courses/106105162/
2. http://www.nptelvideos.in/2012/11/cryptography-and-network-security.html
• Prerequisite
• Recap
• Message Authentication
• Message Authentication requirement and functions
14
Roshan Jameel Introduction to Cryptography and Information
12/06/2023
Security Unit 04
Content
15
Roshan Jameel Introduction to Cryptography and Information
12/06/2023
Security Unit 04
Content
Digital Signature
Digital Signature Standard
16
Roshan Jameel Introduction to Cryptography and Information
12/06/2023
Security Unit 04
Objective of Unit -4
19
Roshan Jameel Introduction to Cryptography and Information
12/06/2023
Security Unit 04
Cryptographic Hash Function CO4
06/12/2023 20
Roshan Jameel Introduction to Cryptography and Information
Security Unit 04
Cryptographic Hash Function CO4
In particular, cryptographic hash functions exhibit these three properties:
•They are “collision-free.” This means that no two input hashes should map to the same
output hash.
•They can be “hidden”. It should be difficult to guess the input value for a hash function from
its output.
•They should be “puzzle-friendly”. It should be difficult to select an input that provides a pre-
defined output. Thus, the input should be selected from a distribution that's as wide as
possible.
06/12/2023 21
Roshan Jameel Introduction to Cryptography and Information
Security Unit 04
Message Digest CO4
• Hash: It is the finger print of a message, same as Message digest, which identifies
a message uniquely.
06/12/2023 22
Roshan Jameel Introduction to Cryptography and Information
Security Unit 04
Message Digest CO4
Then, we multiply each digit in the number with the next digit (excluding it if it is 0),
and disregarding the first digit of the multiplication operation, if the result is a two-
digit number. Thus, 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. So far, we are considering very simple cases of message
digests. Actually, the message digests are not so small and straightforward to
compute. Message digests usually consist of 128 or more bits. The message-digest
length is chosen to be so long with a purpose. This ensures that the scope for two
message digests is the same.
23
Roshan Jameel Introduction to Cryptography and Information
12/06/2023
Security Unit 04
Requirements of a Message Digest CO4
• (b) Given a message digest, it should be very difficult to find the original
message for which the digest was created.
• Given any two messages, if we calculate their message digests, the two
message digests must be different.
06/12/2023 24
Roshan Jameel Introduction to Cryptography and Information
Security Unit 04
Message Digest CO4
06/12/2023 25
Roshan Jameel Introduction to Cryptography and Information
Security Unit 04
Message Digest CO4
06/12/2023 26
Roshan Jameel Introduction to Cryptography and Information
Security Unit 04
Birthday Attack CO4
If any two messages produce the same message digest, thus violating our principle,
it is called a collision. That is, if two message digests collide, they meet at the digest!
As we shall study soon, the message-digest algorithms usually produce a message
digest having a length of 128 bits or 160 bits. This means that the chances of any
two message digests being the same are one in 2128 or 2160, respectively. Clearly,
this seems possible only in theory, but extremely rare in practice.
A specific type of security attack called birthday attack is used to detect collisions in
message-digest algorithms. It is based on the principle of the Birthday Paradox,
which states that if there are 23 people in a room, chances are more than 50% of
the people will share the same birthday. At first, this may seem to be illogical.
However, we can understand this in another manner.
06/12/2023 27
Roshan Jameel Introduction to Cryptography and Information
Security Unit 04
Birthday Attack CO4
We need to keep in mind we are just talking about any two people (out of the 23) sharing the same
birthday. Moreover, we are not talking about this sharing with a specific person.
For instance, suppose that we have Alice, Bob, and Carol as three of the 23 people in the room.
Therefore, Alice has 22 possibilities to share a birthday with anyone else (since there are 22 pairs of
people). If there is no matching birthday for Alice, she leaves. Bob now has 21 chances to share a
birthday with anyone else in the room. If he fails to have a match too, the next person is Carol. She
has 20 chances, and so on. 22 pairs + 21 pairs + 20 pairs ... + 1 pair means that there is a total of 253
pairs. Every pair has a 1/365th chance of finding a matching birthday. Clearly, the chances of a match
cross 50% at 253 pairs. The birthday attack is most often used to attempt to discover collisions in
hash functions, such as MD5 or SHA1.
Chances will be 99.9% if there are 70 people in that room and 100% if there are 366 people.
06/12/2023 28
Roshan Jameel Introduction to Cryptography and Information
Security Unit 04
Message Authentication Requirements CO4
06/12/2023 29
Roshan Jameel Introduction to Cryptography and Information
Security Unit 04
Message Authentication Function CO4
06/12/2023 30
Roshan Jameel Introduction to Cryptography and Information
Security Unit 04
Message Authentication Function CO4
06/12/2023 31
Roshan Jameel Introduction to Cryptography and Information
Security Unit 04
Message Authentication CO4
Message Encryption
32
Roshan Jameel Introduction to Cryptography and Information
12/06/2023
Security Unit 04
Message Authentication CO4
33
Roshan Jameel Introduction to Cryptography and Information
12/06/2023
Security Unit 04
Message Authentication CO4
Notations:
m: message
Note H(m): message digest of m by using hash function H()
Hash Function
A hash function accepts a variable-size message M as
input and reduces a fixedsize output, referred to as a
hash code H(M).
A hash code does not use a key but is a function only of
the input message. The hash code is also referred to as
a message digest or hash value. The hash code is a
function of all the bits of the message and provides an
error-detection.
Note
06/12/2023 36
Roshan Jameel Introduction to Cryptography and Information
Security Unit 04
Message Authentication CO4
h = H(M)
where M is the variable length message
H is the hash function
h is the fixed length hash value
37
Roshan Jameel Introduction to Cryptography and Information
12/06/2023
Security Unit 04
Message Authentication CO4
Requirements of MAC
• Prerequisite
• Recap
• MD5 Algorithm
• Secure Hash Algorithm
Objective of Topic :- Study about Study about MD5 Algorithm and
Secure Hash Algorithm
MD5 :
40
Roshan Jameel Introduction to Cryptography and Information
12/06/2023
Security Unit 04
Message Authentication Algorithm CO4
1. Architecture of MD5
MD5 message digest algorithm is the 5th version of
the Message Digest Algorithm developed by Ron Rivest
to produce 128 bit message digest.
MD5 produces the message digest through five steps
i.e. padding, append length, divide input into 512 bit
blocks, initialize chaining variables a process blocks and
4 rounds, uses different constant it in each iteration.
41
Roshan Jameel Introduction to Cryptography and Information
12/06/2023
Security Unit 04
Message Authentication Algorithm CO4
42
Roshan Jameel Introduction to Cryptography and Information
12/06/2023
Security Unit 04
Working of MD5 CO4
Padding:
The first step in MD5 is to add padding bits to the original message. The aim of this
step is to make the length of the original message equal to a value, which is 64 bits
less than an exact multiple of 512. The padding consists of a single 1 bit, followed by
as many 0 bits, as required. Note that padding is always added, even if the message
length is already 64 bits less than a multiple of 512. Thus, if the message were
already of a length of say 448 bits, we will add a padding of 512 bits to make its
length 960 bits. Thus, the padding length is any value between 1 and 512.
43
Roshan Jameel Introduction to Cryptography and Information
12/06/2023
Security Unit 04
MD5 CO4
06/12/2023 44
Roshan Jameel Introduction to Cryptography and Information
12/06/2023
Security Unit 04
Working of MD5 CO4
06/12/2023 45
Roshan Jameel Introduction to Cryptography and Information
12/06/2023
Security Unit 04
Working of MD5 CO4
06/12/2023 46
Roshan Jameel Introduction to Cryptography and Information
12/06/2023
Security Unit 04
Working of MD5 CO4
Step 3: Divide the Input into 512-bit Blocks Now, we divide the input message into
blocks, each of length 512 bits.
Step 4: Initialize Chaining Variables In this step, four variables (called chaining
variables) are initialized. They are called A, B, C and D. Each of these is a 32-bit
number.
Step 5: Process Blocks After all the initializations, the real algorithm begins. It is
quite complicated, and we shall discuss it step by step to simplify it to the maximum
extent possible. There is a loop that runs for as many 512-bit blocks as are in the
message.
06/12/2023 47
Roshan Jameel Introduction to Cryptography and Information
12/06/2023
Security Unit 04
Working of MD5 CO4
Step 5.1 Copy the four chaining variables into four corresponding variables, a, b, c
and d (note the smaller case). Thus, we now have a = A, b = B, c = C and d = D
Step 5.2 Divide the current 512-bit block into 16 sub-blocks. Thus, each sub-block
contains 32 bits.
Step 5.3 Now, we have 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.
Step 1 of the four rounds has different processing. The other steps in all the four
rounds are the same.
06/12/2023 48
Roshan Jameel Introduction to Cryptography and Information
12/06/2023
Security Unit 04
Working of MD5 CO4
06/12/2023 49
Roshan Jameel Introduction to Cryptography and Information
12/06/2023
Security Unit 04
Working of MD5 CO4
06/12/2023 50
Roshan Jameel Introduction to Cryptography and Information
12/06/2023
Security Unit 04
Working of MD5 CO4
06/12/2023 51
Roshan Jameel Introduction to Cryptography and Information
12/06/2023
Security Unit 04
Message Authentication Algorithm CO4
SHA-1
It works for any input message that is less than
264 bits.
The output of SHA is a message digest of 160 bits in
length.
This is designed to be computationally infeasible to:
a) Obtain the original message , given its message digest.
06/12/2023 53
Roshan Jameel Introduction to Cryptography and Information
12/06/2023
Security Unit 04
Message Authentication Algorithm CO4
Properties of SHA
06/12/2023 54
Roshan Jameel Introduction to Cryptography and Information
12/06/2023
Security Unit 04
Message Authentication Algorithm CO4
How SHA-1 works?
Step 1: Padding of Bits
06/12/2023 57
Roshan Jameel Introduction to Cryptography and Information
12/06/2023
Security Unit 04
Message Authentication Algorithm CO4
06/12/2023 58
Roshan Jameel Introduction to Cryptography and Information
12/06/2023
Security Unit 04
Message Authentication Algorithm CO4
Comparison between MD5 and SHA-1
Point of discussion MD5 SHA-1
Message digest length in 128 160
bits
Attack to try and find the Requires 2128 operations to Requires 2160 operations to
original message given a break in. break in, therefore more
message digest secure.
Attack to try and find two Requires 264 operations to Requires 280 operations to
messages producing break in. break in.
same message digest
06/12/2023 59
Roshan Jameel Introduction to Cryptography and Information
12/06/2023
Security Unit 04
Message Authentication Algorithm CO4
Parameters for various versions of SHA
06/12/2023 60
Roshan Jameel Introduction to Cryptography and Information
12/06/2023
Security Unit 04
Digital Signature CO4
• Prerequisite
• Recap
• Digital Signatures
• DSS
06/12/2023 61
Roshan Jameel Introduction to Cryptography and Information
12/06/2023
Security Unit 04
Digital Signature CO4
06/12/2023 62
Roshan Jameel Introduction to Cryptography and Information
12/06/2023
Security Unit 04
Digital Signature CO4
Note
A digital signature needs a public-key system.
The signer signs with her private key; the verifier
verifies with the signer’s public key.
06/12/2023 63
Roshan Jameel Introduction to Cryptography and Information
12/06/2023
Security Unit 04
Digital Signature CO4
Note
Message Authentication
Note
A digital signature provides message authentication.
06/12/2023 65
Roshan Jameel Introduction to Cryptography and Information
12/06/2023
Security Unit 04
Digital Signature Services CO4
Message Integrity
Note
06/12/2023 66
Roshan Jameel Introduction to Cryptography and Information
12/06/2023
Security Unit 04
Digital Signature Services CO4
non-repudiation
Note
06/12/2023 67
Roshan Jameel Introduction to Cryptography and Information
12/06/2023
Security Unit 04
Digital Signature Services CO4
Confidentiality
Note
06/12/2023 69
12/06/2023 Roshan Jameel Introduction to Cryptography and Information
Security Unit 04
Digital Signature Services CO4
Note
In ElGamal digital signature scheme, (e1, e2, p) is
Alice’s public key; d is her private key.
06/12/2023 70
Roshan Jameel Introduction to Cryptography and Information
12/06/2023
Security Unit 04
Digital Signature Schemes CO4
06/12/2023 71
Roshan Jameel Introduction to Cryptography and Information
12/06/2023
Security Unit 04
Digital Signature Schemes CO4
06/12/2023 72
Roshan Jameel Introduction to Cryptography and Information
12/06/2023
Security Unit 04
Digital Signature Schemes CO4
5) Alice’s public key is (e1, e2, p, q); her private key is (d).
06/12/2023 73
Roshan Jameel Introduction to Cryptography and Information
12/06/2023
Security Unit 04
Digital Signature Schemes CO4
DSS scheme
06/12/2023 74
Roshan Jameel Introduction to Cryptography and Information
12/06/2023
Security Unit 04
RSA Digital Signature CO4
RSA can be used for performing digital signatures.
Let us assume that the sender (A) wants to send a message M to the receiver (B) along
with the digital signature (S) calculated over the message (M).
Step 1 The sender (A) uses the SHA-1 message-digest algorithm to calculate the message
digest (MD1) over the original message (M).
Step 2 The sender (A) now encrypts the message digest with her private key. The output
of this process is called the digital signature (DS) of A.
06/12/2023 75
Roshan Jameel Introduction to Cryptography and Information
12/06/2023
Security Unit 04
RSA Digital Signature CO4
Step 3 The sender (A) sends the original message (M) along with the digital signature (DS) to the receiver (B).
Step 4 After the receiver (B) receives the original message (M) and the sender’s (A’s) digital signature, B uses
the same message-digest algorithm as was used by A, and calculates its own message digest (MD2).
Step 5 The receiver (B) now uses the sender’s (A’s) public key to decrypt the digital signature. A had used her
private key to encrypt her message digest (MD1) to form the digital signature. Therefore, only A’s public key
can be used to decrypt it. The output of this process is the original message digest as was calculated by A
(MD1) in step 1.
06/12/2023 76
Roshan Jameel Introduction to Cryptography and Information
12/06/2023
Security Unit 04
RSA Digital Signature CO4
06/12/2023 77
Roshan Jameel Introduction to Cryptography and Information
12/06/2023
Security Unit 04
RSA Digital Signature CO4
Key-only Attack In the key-only attack, the assumption is that the attacker only has access to the genuine user’s public
key. The attacker somehow then obtains a genuine message M and its signature S. The attacker then tries to create
another message MM such that the same signature S looks to be valid on MM. However, it is not an easy attack to launch
since the mathematical complexity beyond this is quite high.
Known-message Attack In the known-message attack, the attacker tries to use a feature of RSA whereby two different
messages having two different signatures can be so combined so that their signatures also combine. To take an example,
let us say that we have two different messages M1 and M2 with respective digital signatures as S1 and S2. Then if M =
(M1 ¥ M2) mod n, mathematically S = (S1 ¥ S2) mod n. Hence, the attacker can compute M = (M1 ¥ M2) mod n and then S
= (S1 ¥ S2) mod n to forge a signature.
06/12/2023 78
Roshan Jameel Introduction to Cryptography and Information
12/06/2023
Security Unit 04
Daily Quiz
(c) MAC
(a) SHA-512
(b) SHA-256
(c) SHA-128
(d) SHA-1
(a) RC5
(b) Blowfish
(c) ECC
(d) MAC
(a) Attack
(b) Collision
(c) Hash
(a) 264
(b) 280
(c) 2256
(d) 272
(a) can
(b) cannot
(c) must
(a) Authentication
(b) Confidentiality
(d) Nonrepudiation
a. Authentication
b. Non repudiation
c. Data Integrity
a. Password Check
c. Digital Signatures
a) Pre-Image Resistance
b) Compression
a) Pre-Image Resistance
b) Compression
a) Hash value
b) Hash Code
c) Message Digest
https://aktu.ac.in/question-bank.html