Module-III & IV
Module-III & IV
Prepared by
N. Shalini
Assistant Professor
CYBER SECURITY
MALLAREDDY UNIVERSITY
Maisammaguda, Dulapally, Hyderabad, Telangana 500043
MODULE – III
5
Popular Cryptographic Hash Functions
Here are some widely used cryptographic hash functions:
1. MD5 (Message Digest Algorithm 5):
Produces a 128-bit hash.
6
Applications of Hash Functions
7
Applications of Hash Functions
8
Applications of Hash Functions
9
Applications of Hash Functions
10
Applications of Hash Functions
11
Applications of Hash Functions
12
Applications of Hash Functions
13
Applications of Hash Functions
14
Applications of Hash Functions
15
Properties of Cryptographic Hash Functions or Simple
hash functions and features for ensuring security
1. Deterministic: same input will always produce the same hash
value.
2. Fixed Output Size:Regardless of the input size, the output
hash has a fixed length (e.g., 256 bits in SHA-256).
3. Preimage Resistance:Given a hash value 𝐻(𝑥), it should be
computationally infeasible to find the original input 𝑥.
4. Second Preimage Resistance: It should be computationally
infeasible to find another input ′x ′ such that the hash of ′x ′ is
the same as the hash of x (i.e., 𝐻(𝑥)=𝐻(𝑥′).
5. Collision Resistance: It should be extremely difficult to find
two distinct inputs 𝑥 and 𝑥′ that produce the same hash value
(i.e., 𝐻(𝑥)=𝐻(𝑥′).
6. Avalanche Effect: A small change in the input (even a single
bit) should produce a significantly different hash output.
7.Fast to Compute: Hash functions should be efficient and fast
to compute, even for large inputs. 16
Hash functions based on Cipher Block Chaining
modes of operations for a Block Ciphers :Cipher Block
Chaining : In CBC, the previous cipher block is given as input to
the next encryption algorithm after XOR with the original
plaintext block. here, a cipher block is produced by encrypting
an XOR output of the previous cipher block and present
plaintext block.
17
Hash functions based on Cipher Block Chaining
There are two major categories of hash functions are : dedicated
hash functions and block cipher based hash functions.
18
Hash functions based on Cipher Block Chaining
19
Hash functions based on Cipher Block Chaining
22
Secure Hash Algorithm(SHA)
SHA-1:
Message Size: Accepts input of any length.
Block Size: 512 bits (64 bytes).
Output Size: 160 bits (20 bytes).
Structure: It operates by breaking the message into
512-bit blocks and processing each block through 80
rounds of bitwise operations.
Status: Vulnerable to collision attacks (two different
inputs producing the same hash), making it unsuitable
for most cryptographic purposes.
24
SHA-2 (SHA-256 and SHA-512):
SHA-256:
Message Size: Any length.
Block Size: 512 bits.
Output Size: 256 bits (32 bytes).
SHA-512:
Message Size: Any length.
Block Size: 1024 bits.
Output Size: 512 bits. (64 bytes).
Structure: Both algorithms are part of the SHA-2 family
and operate on blocks of data. They apply complex
mathematical transformations over multiple rounds (64
rounds for SHA-256 and 80 rounds for SHA-512) to
ensure the security of the hash.
25
Steps of the SHA Algorithm:
26
Secure Hash Algorithm(SHA)
27
Secure Hash Algorithm(SHA)
28
Secure Hash Algorithm(SHA)
STEP 1:
29
Secure Hash Algorithm(SHA)
30
Secure Hash Algorithm(SHA)
31
Secure Hash Algorithm(SHA)
32
Secure Hash Algorithm(SHA)
STEP 2:
33
Secure Hash Algorithm(SHA)
STEP 3:
34
Secure Hash Algorithm(SHA)
STEP 3:
35
Secure Hash Algorithm(SHA)
36
Secure Hash Algorithm(SHA)
37
Secure Hash Algorithm(SHA)
38
Secure Hash Algorithm(SHA)
39
Message Authentication:
Authentication Systems :
Authentication is a process in which a principal proves that
he/she/it is the entity it claims to be.
41
Message Authentication:
42
Message Authentication:
43
Message Authentication:
v. Packet sniffing:
As another attempt, attackers may intercept the packets flowing
through the network. Some protocols let out the passwords in
clear text while transmitting, which may be grabbed by attackers
sniffing the packets.
45
Message Authentication:
46
Message Authentication:
49
Message Authentication:
50
Message Authentication:
Retinal Scanner.
Fingerprint readers.
Face recognition
IRIS scanner
Handprint readers.
Voiceprints.
51
Authentication Standards :
52
Authentication Standerds :
53
Authentication Standerds :
The sender signs a hashed message with their private key. The
recipient uses the sender's public key to verify the signature. If
the signature matches the message, authenticity is confirmed.
4.Kerberos Authentication:
• Kerberos is a network authentication protocol that uses tickets
to authenticate users and services in a secure manner,
protecting against replay attacks.
54
Authentication Standerds :
55
Kerberos
56
Main Components of Kerberos
58
Public Key Infrastructure (PKI)
1.certigicate repository.
It stores all the certificate information like information related to
certificate when to revoke, when to give access all kind of
information stores it (it will stores the users /owners id, name )
2.Entity:
It is a user of PKI. It can be a router, single person , group or
organization is using PKI.(who Is trying to access
3.regstration authority:
It is for registration and verification purpose.ie if any device raising
request for accessing certificate then it register the request and verify
the user.
4.certificate authority:
It is decided to whenever give give certificate to user and it is
responsible to issuing ,revoking, distributing certificates.It will decide
time limit of the user.
60
Architecture of PKI
Purpose of PKI:
The purpose of PKI is to facilitate the secure electronic transfer of
information over the internet.
There are many policies , standards, procedures in PKI and all these
for building a trust.
What is trust:
Trust is confidence in or reliance on another person or entity.
61
Architecture of PKI
If two individuals trust each other because each trust a third party it is
a third party trust.
63
PKI Trust Models
65
PKI Trust Models
66
PKI Trust Models
67
PKI Trust Models
68
Message Authentication Codes (MAC)
69
Message Authentication Codes (MAC)
70
Message Authentication Codes (MAC)
71
Message Authentication Codes (MAC)
72
Message Authentication Codes (MAC)
73
Message Authentication Codes (MAC)
74
HMAC Algorithm
PROCEDURE HMAC:
Step 1:we have to compute s bits.
Step 2:after computing S-bits append S-bits to plain text or msg S||M.
Step 3: then perform the Hashing function.
75
HMAC Algorithm
HMAC Algorithm:
Step 1:Append 0’s to left end of K to get K+.
Step 2: perform XOR operation K+ with ipad to obtain Si.
Step 3: Si||M(Si is appended with Plaint text).
Step 4: apply any hash algorithm to the steam generated in step 3.
Step 5: XOR K+ with Opad to generate SO.
Step 6: append SO||result of step 4.
Step 7: apply hashing algorithm to step 6.
Here, H stands for hashing function,
M is the original message
Si and So are input and output signatures respectively,
Yi is the I th block in original message M, where I ranges from [1, L)
L = the count of blocks in M
K is the secret key used for hashing IV is an initial vector (some
constant) The generation of input signature and output
76
Message authentication code based on block cipher
There are two methods used in MAC based on block cipher.
1.DAA(data authentication algorithm)
2.CMAC(cipher based message authentication code)
1.DAA(data authentication code):
• One of the most widely used MACs is referred to as the Data
Authentication Algorithm.
• The algorithm is designed using the Cipher Block Chaining
mode of operation of DES, as shown in figure. The data (e.g.,
message, record, file, or program) to be authenticated are
grouped into fixed size 64-bit blocks: D1, D2,….., DN.
• If necessary, the final block is padded on the right with zeroes
to make a 64-bit blocks. Using the DES encryption algorithm
and a secret key, a data authentication code (DAC) is
calculated as follows:
• The DAC consists of either the entire block ON
77
Message authentication based on block cipher
78
Message authentication code based on block cipher
Cipher based message authentication code (CMAC):
• Data Authentication Algorithm (DAA), which is now obsolete.
DACs are prone to collision attacks, where two different
messages produce the same authentication code. This can
compromise the integrity of the message.
• Then CMAC, which is designed to overcome the deficiencies
of DAA. Cipher-based Message Authentication Code (CMAC)
mode of operation for use with AES and triple DES.
• First, let us define the operation of CMAC when the message
is an integer multiple n of the cipher block length b.
• For AES, b=128, and for triple DES, b=64. The message is
divided into n blocks (M1, M2,…, Mn ).
• For AES, the key size is 128, 192, or 256 bits; for triple DES,
the key size is 112 or 168 bits. CMAC is calculated as follows:
C1 = E(K, M1) C2 = E(K, [M2 ⊕C1]) C3 = E(K, [M3 ⊕C2]) . . .
Cn = E(K, [Mn ⊕Cn-1 ⊕K1]) 79
Message authentication code based on block cipher
80
UNIT–IV: SYLLABUS
81
UNIT–IV: SYLLABUS
Lucifer: Lucifer is an important cipher in the history
of cryptography and information theory. It was
developed in the 1970s by IBM cryptographers,
including Horst Feistel, and serves as the direct
precursor to the Data Encryption Standard (DES), a
widely used encryption algorithm in the late 20th
century.
Key Features of Lucifer in Information Theory:
Lucifer is based on the Feistel structure, where the
plaintext is divided into two halves. One half is encrypted
using a key and then combined with the other half using
an XOR operation. The halves are swapped in each
round of encryption. 82
Key Features of Lucifer in Information Theory:
83
Key Features of Lucifer in Information Theory:
88
Madryga cipher
• The input message (plaintext) is broken into blocks,
shown at the top. The blocks are labeled numerically (1, 2,
3, etc.), and the last few blocks are denoted as TL-1, TL,
etc.
• The input is divided into 8-bit block, and the diagram
shows that multiple working frames (WF1, WF2, etc.)
operate on the text at each step.
• This involves the rotation of target bits in the 16-bit block.
The process might change the positions of bits or groups
of bits to provide confusion, a key principle in
cryptography.
• The next phase involves rotating bits based on a 3-bit
"rotate count," which determines how much the block will
be shifted 89
Madryga cipher
• After rotation, the Translate Target operation applies XOR
(exclusive OR) operations between the bits and parts of
the key to increase security.
• this section represents the key material used in the XOR
operation with the data in the Translation stage. The key
bits are also rotated and XORed in steps.
• this step involves hashing or applying another
cryptographic process to the key itself, helping ensure the
key remains secure and difficult to reverse.
90
New DES (N-DES)
• New DES was designed in 1985 by Robert Scott as a
possible DES replacement.
• New DES (N-DES) is a theoretical extension of the Data
Encryption Standard (DES), often used in research or to
address the weaknesses of the original DES algorithm.
DES, a widely used encryption algorithm from the 1970s,
had vulnerabilities primarily due to its relatively short key
size of 56 bits. As computing power grew, brute force
attacks became feasible, leading to the development of
new cryptographic techniques and alternatives to DES,
such as Triple DES (3DES) and AES (Advanced
Encryption Standard).
91
Key Characteristics of N-DES:
• Instead of the standard 16 rounds of encryption in DES,
N-DES could theoretically increase the number of rounds
to improve security. For example, performing DES
multiple times with different keys (like in Triple DES)
increases the effective key size and security.
• N-DES could extend the key length beyond 56 bits,
addressing the vulnerability of the original DES to brute-
force attacks. The idea is to use keys of sizes similar to
modern standards, like 128 or 256 bits.
• While the core Feistel structure and S-boxes of DES
might remain unchanged in N-DES, alterations could be
made to the permutation functions or S-boxes to increase
security.
92
Key Characteristics of N-DES:
93
Key Characteristics of N-DES:
94
GOST block cipher
The GOST block cipher is a symmetric encryption algorithm
developed by Soviet Union in the 1980s. Officially known as
GOST 28147-89, it became the standard for encryption in Russia
and former Soviet states. GOST stands for "Gosudarstvennyi
Standard" OR “GOvernment Standard” which means "state
standard" in Russian.
GOST is a block cipher means GOST operates on 64-bit blocks of
data, which means that the plaintext is divided into chunks of 64 bits
each for encryption.
it uses a 256-bit key, which provides strong encryption against brute-
force attacks. 95
GOST block cipher
• Similar to DES (Data Encryption Standard), GOST uses a Feistel
network, where the plaintext is split into two halves and processed
iteratively in rounds.
• GOST applies 32 rounds of encryption for each block of plaintext.
In each round, one half of the data is modified by a subkey and a
non-linear function, while the other half remains unchanged.
• The 256-bit key is divided into eight 32-bit subkeys. These subkeys
are cyclically reused throughout the encryption process, contributing
to the overall complexity.
• In GOST S-boxes can be kept secret to increase the size of the key.
96
GOST block cipher
97
GOST block cipher
• In GOST round function consist of three steps.
1. Integer addition of input and round key with mod 2^32
2. Apply the eight 4-bit S-boxes to the result.
3. Perform circular left shift 11 on the result .
In each round the result of the round function is XOR-ed with the left
input , which then becomes the new right output while the right input
becomes the new left output.
98
GOST block cipher
99
GOST block cipher
100
GOST block cipher
101
GOST block cipher
• if you encrypt a 64-bit plaintext using a 256-bit key, the data will
pass through 32 rounds of transformation, where each round will
involve splitting, modular addition, and substitution. The final output
will be a 64-bit ciphertext.
• Strength: GOST's 256-bit key and 32 rounds make it highly
resistant to brute-force attacks. Its structure, similar to the Feistel
network, adds an extra layer of security through complex
transformations.
• Applications: GOST was used extensively in Russian governmental
and military applications. In addition to encryption, it was also
adapted for use in hashing algorithms and digital signatures. 102
3-Way block cipher
106
CRAB
109
Rivest Cipher5 (RC5)
110
Rivest Cipher5 (RC5)
111
Rivest Cipher5 (RC5)
112
Double Encryption:
Double encryption refers to the process of applying an
encryption algorithm twice with two different keys.
While it seems that encrypting a message twice would
provide added security, in practice, double encryption
does not necessarily double the strength of the
encryption.
Consider the DES (Data Encryption Standard)
algorithm:
Given plaintext M, two keys K1 and K2, and encryption
functions EK1 and EK2 , the double encryption process
can be represented as
Encryption=C=E K2 (EK1 (M)) decryption =M=D K1 (D K2 (C))
113
Double Encryption:
Double encryption doesn't provide the expected level of
security due to a meet-in-the-middle attack, which
reduces the effectiveness of double encryption by
finding a match between the intermediate ciphertext
from both encryption and decryption processes, leading
to a reduced security.
114
Triple Encryption:
Triple encryption is an approach to strengthen
encryption by applying an encryption algorithm three
times with potentially different keys.
The most well-known example is Triple DES (3DES),
which applies the DES encryption algorithm three times
in succession.
Encrypt-Decrypt-Encrypt (EDE) Mode: In this mode,
three keys K1, K2, and K3 are used.
The plaintext is encrypted with the first key (K1), then
decrypted with the second key (K2), and finally
encrypted again with the third key (K3):
For encryption: C=E K3 (D K2 (E K1 (M)))
For decryption: M=D K1 (E K2 (D K3 (C)))
115
CDMF Key Shortening – Whitening
CDMF (Commercial Data Masking Facility) is a
technique used to reduce the strength of encryption
keys, developed as part of IBM's approach to meet
U.S. This method is specifically used with the Data
Encryption Standard (DES) algorithm.
Purpose: The key shortening mechanism was designed
to reduce the effective key size of DES from 56 bits to
40 bits.
The CDMF key shortening process involves taking the
original 56-bit DES key, applying an algorithm to reduce
it to a 40-bit key by masking or weakening parts of the
key, making the encryption significantly less secure.
116
CDMF Key Shortening – Whitening
Security Issues: With only 40 bits of key length,
encryption using CDMF could be easily broken with
modern computational power. A brute force attack on a
40-bit key would require trying at most 2402 40
possible keys.
Whitening:
Whitening is a technique used to improve the security of
encryption algorithms by adding additional steps before
and after encryption.
Process: In whitening, key-dependent values, referred
to as "whitening keys," are XORed with the plaintext
before encryption and with the ciphertext after
encryption.
117
CDMF Key Shortening – Whitening
Mathematical Representation:
Let P be the plaintext, W1 and W2 be the whitening
keys, and EK the encryption function with key K.
The whitening encryption process can be represented
as:
C=W2⊕EK (W1⊕P)
Whitening is a technique used to enhance the security
of encryption by XORing additional keys with plaintext
and ciphertext, thus making certain types of
cryptanalytic attacks more difficult.
118
119