0% found this document useful (0 votes)
9 views41 pages

Lesson 6 DES Algorithm

The document provides an overview of the Data Encryption Standard (DES), detailing its structure based on the Feistel cipher and the processes involved in encryption and decryption. It outlines key aspects such as block size, key size, number of rounds, and the generation of sub-keys, emphasizing the importance of substitution and transposition in cryptography. Additionally, it describes the initial permutation, key transformation, and the creation of sub-keys necessary for the encryption process.

Uploaded by

Yasin Ebrahimi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views41 pages

Lesson 6 DES Algorithm

The document provides an overview of the Data Encryption Standard (DES), detailing its structure based on the Feistel cipher and the processes involved in encryption and decryption. It outlines key aspects such as block size, key size, number of rounds, and the generation of sub-keys, emphasizing the importance of substitution and transposition in cryptography. Additionally, it describes the initial permutation, key transformation, and the creation of sub-keys necessary for the encryption process.

Uploaded by

Yasin Ebrahimi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 41

1

November 2023
Data Encryption Standard
Information Security

Data Encryption Standard

S. Hassan Adelyar, Ph.D


Instructor of Computer Science Faculty
Kabul University

November 2023
2
Feistel Cipher Structure November 2023
Data Encryption Standard
◼ Many symmetric block encryption algorithms,
including DES, have a structure first described
by Horst Feistel of IBM in 1973.
Information Security

◼ Feistel Structure Algorithm:


◼ Inputs: Plaintext block of length 2w bits & a
key.
◼ The plaintext block is divided into two
halves, L0 and R0.
3
November 2023
Data Encryption Standard
◼ The two halves of the data pass through n
rounds of processing and then combine to
produce the cipher-text block.
Information Security

◼ Each round i has as inputs Li-1 and Ri-1,


derived from the previous round, as well as a
sub-key Ki , derived from the overall K.
◼ In general, the sub-keys Ki are different
from K & from each other, & are generated
from the key by a sub-key generation
algorithm.
4
November 2023
Data Encryption Standard

◼ All rounds have the same structure & include


the following steps:
Information Security

◼ Applying a round function F to the right


half of the data
◼ Taking the XOR of the output of function F
& the left half of the data.
◼ The round function has the same general
structure for each round but is
parameterized by the round sub-key Ki .
Classical Feistel Network
5
November 2023
Data Encryption Standard
Information Security
6
November 2023
Data Encryption Standard
◼ The exact realization of a symmetric block
cipher depends on the choice of the following
parameters and design features:
Information Security

◼ Block size:
◼ Security & speed depends on the block size.

◼ Key size:
◼ Security & speed depends on the key size.
7
November 2023
Data Encryption Standard
◼ Number of rounds:
◼ Multiple rounds offer increasing security.
Information Security

◼ Sub-key generation algorithm:


◼ Complexity in this algorithm make
cryptanalysis difficult.
◼ Round function:
◼ Complexity in this function make
cryptanalysis difficult.
8
November 2023
Data Encryption Standard
◼ Decryption in block cipher is the same as the
encryption process. The rule is:
◼ Use the cipher-text as input but use the sub-
Information Security

keys Ki in reverse order.


◼ That is, use Kn in the first round, Kn-1 in the
second round, & so on.
9
Data Encryption Standards (DES)November 2023
Data Encryption Standard
◼ Plaintext is 64 bits, key is 56 bits.
◼ DES structure is a minor variation of the
Information Security

Feistel network.
◼ There are 16 rounds of processing.
◼ From the original 56-bit key, 16 sub-keys are
generated, one for each round.
10
November 2023
Data Encryption Standard

▪ DES is based on the two fundamental


attributes of cryptography:
Information Security

▪ Substitution (confusion / mix-up)


▪ Transposition (diffusion / distribution).
▪ Each round performs the steps of substitution
& transposition.
11
DES Broad Level Steps November 2023
Data Encryption Standard
Information Security
12
November 2023
Data Encryption Standard

▪ Main Steps:
▪ Initial Permutation / Variation
▪ Key Transformation
Information Security

▪ Expansion Permutation
▪ S-Bob
▪ P-Box
▪ XOR
▪ Swap
13
November 2023
Data Encryption Standard
◼ Initial Permutation (IP)
◼ It replaces the first bit of the original plain
Information Security

text block with the 58th bit of the original


plain text, the second bit with the 50th bit of
the original plain text block, and so on.
14
November 2023
Data Encryption Standard
▪ Example:
▪ Let M be the plain text message:
▪ M = 0123456789ABCDEF, where M is in
Information Security

hexadecimal (base 16) format.


▪ Rewriting M in binary format, we get the 64-
bit block of text:
▪ M = 0000 0001 0010 0011 0100 0101 0110
0111 1000 1001 1010 1011 1100 1101 1110
1111
15
November 2023
Data Encryption Standard
▪ Example:
▪ Applying the initial permutation to the block of
text M, given previously, we get
Information Security

▪ M = 0000 0001 0010 0011 0100 0101 0110 0111


1000 1001 1010 1011 1100 1101 1110 1111
▪ IP = 1100 1100 0000 0000 1100 1100 1111 1111
1111 0000 1010 1010 1111 0000 1010 1010
▪ Here the 58th bit of M is "1", which becomes
the first bit of IP.
▪ The 50th bit of M is "1", which becomes the
second bit of IP.
16
November 2023
Data Encryption Standard
▪ The 7th bit of M is "0", which becomes the last
bit of IP.
▪ Next divide the permuted block IP into a left
Information Security

half L0 of 32 bits, and a right half R0 of 32


bits.
▪ Example:
▪ From IP, we get L0 and R0
▪ L0 = 1100 1100 0000 0000 1100 1100 1111 1111
▪ R0 = 1111 0000 1010 1010 1111 0000 1010 1010
17
November 2023
Data Encryption Standard
◼ Key Transformation
◼ Initial key consists of 64 bits & every 8th bit
Information Security

(8, 16, 24, 32, 40, 48, 56, and 64) of the key
is discarded to produce a 56-bit key.
18
November 2023
Data Encryption Standard
◼ From 56-bit key, a different 48-bit Sub Keys
are generated during each round.
Information Security

◼ The 56-bit key is divided into two halves,


each of 28 bits.
◼ These halves are circularly shifted left by
one or two positions, depending on the
round.
19
November 2023
Data Encryption Standard
▪ Example:
▪ Let K be the hexadecimal key K =
133457799BBCDFF1.
Information Security

▪ This gives us as the binary key (setting 1 =


0001, 3 = 0011, etc.,) and grouping together
every eight bits:
▪ K = 00010011 00110100 01010111 01111001
10011011 10111100 11011111 1111 0001
20 Create 16 Subkeys, Each 48-bits Long
November 2023
Data Encryption Standard
▪ The 56-bit key is permuted according to the
following table, PC-1.
Information Security
21
November 2023
Data Encryption Standard
▪ Since the first entry in the table is "57", this
means that the 57th bit of the original key K
becomes the first bit of the permuted key K+.
Information Security

▪ The 49th bit of the original key becomes the


second bit of the permuted key.
▪ The 4th bit of the original key is the last bit of
the permuted key.
▪ Note only 56 bits of the original key appear in
the permuted key.
▪ Example:
▪ From the original 64-bit key:
22
November 2023
Data Encryption Standard
▪ Let K be the hexadecimal key K =
133457799BBCDFF1.
▪ K = 00010011 00110100 01010111 01111001
Information Security

10011011 10111100 11011111 11110001


▪ Change it to 56 bits key (discard each 8th bit):
▪ K = 00010011 00110100 01010111 01111001
10011011 10111100 11011111 11110001
▪ Each 8th bit (red) is discarded:
▪ K = 0001001 0011010 0101011 0111100
1001101 1011110 1101111 1111000:
23
November 2023
Data Encryption Standard
▪ we get the 56-bit permutation
▪ K+ = 1111000 0110011 0010101 0101111
0101010 1011001 1001111 0001111
Information Security

▪ Next, split this key into left and right halves, C0


and D0, where each half has 28 bits.
▪ Example:
▪ From the permuted key K+, we get
▪ C0 = 1111000 0110011 0010101 0101111
▪ D0 = 0101010 1011001 1001111 0001111
▪ With C0 and D0 defined, we now create sixteen
blocks Cn and Dn, 1<=n<=16.
24
November 2023
Data Encryption Standard
▪ Each pair of blocks Cn and Dn is formed from
the previous pair Cn-1 and Dn-1, respectively, for
n = 1, 2, ..., 16, using the following schedule of
Information Security

"left shifts" of the previous block.


▪ If the round numbers 1, 2, 9, or 16 the shift is
done by only position for other rounds, the
circular shift is done by two positions.
▪ 1*4 + 2*12 = 28
▪ To do a left shift, move each bit one place to the
left, except for the first bit, which is cycled to
the end of the block.
25
November 2023
Data Encryption Standard
◼ After an appropriate shift, 48 of the 56 bits
are selected (bits 9, 18, 22, 25, 35, 38, 43, &
54 are discarded).
Information Security

◼ For selecting 48 of the 56 bits the table is


shown in the figure given below.
26
November 2023
Data Encryption Standard
◼Since the key transformation process
involves permutation as well as a selection
of a 48-bit subset of the original 56-bit key it
Information Security

is called Compression Permutation.


▪ Because of this compression permutation
technique, a different subset of key bits is
used in each round.
▪ That makes DES not easy to crack.
27
November 2023
Data Encryption Standard
▪ This means, for example, C3 and D3 are
obtained from C2 and D2, respectively, by two
left shifts, and C16 and D16 are obtained from
Information Security

C15 and D15, respectively, by one left shift.


▪ In all cases, by a single left shift is meant a
rotation of the bits one place to the left, so that
after one left shift the bits in the 28 positions are
the bits that were previously in positions 2, 3,...,
28, 1.
28
November 2023
Data Encryption Standard
▪ Example: From original pair C0 and D0 we
obtain:
▪ C0 = 1111000011001100101010101111
Information Security

▪ D0 = 0101010101100110011110001111
▪ C1 = 1110000110011001010101011111
▪ D1 = 1010101011001100111100011110
▪ C2 = 1100001100110010101010111111
▪ D2 = 0101010110011001111000111101
▪ C3 = 0000110011001010101011111111
▪ D3 = 0101011001100111100011110101
29
November 2023
Data Encryption Standard
▪ C4 = 0011001100101010101111111100
▪ D4 = 0101100110011110001111010101
▪ C5 = 1100110010101010111111110000
Information Security

▪ D5 = 0110011001111000111101010101
▪ C6 = 0011001010101011111111000011
▪ D6 = 1001100111100011110101010101
▪ C7 = 1100101010101111111100001100
▪ D7 = 0110011110001111010101010110
▪ C8 = 0010101010111111110000110011
▪ D8 = 1001111000111101010101011001
30
November 2023
Data Encryption Standard
▪ C9 = 0101010101111111100001100110
▪ D9 = 0011110001111010101010110011
▪ C10 = 0101010111111110000110011001
Information Security

▪ D10 = 1111000111101010101011001100
▪ C11 = 0101011111111000011001100101
▪ D11 = 1100011110101010101100110011
▪ C12 = 0101111111100001100110010101
▪ D12 = 0001111010101010110011001111
▪ C13 = 0111111110000110011001010101
▪ D13 = 0111101010101011001100111100
31
November 2023
Data Encryption Standard
▪ C14 = 1111111000011001100101010101
▪ D14 = 1110101010101100110011110001
▪ C15 = 1111100001100110010101010111
Information Security

▪ D15 = 1010101010110011001111000111
▪ C16 = 1111000011001100101010101111
▪ D16 = 0101010101100110011110001111
32
November 2023
Data Encryption Standard
▪ We now form the keys Kn, for 1<=n<=16, by
applying the following permutation table to
each of the concatenated pairs CnDn.
Information Security

▪ Each pair has 56 bits, but PC-2 only uses 48 of


these.
33
November 2023
Data Encryption Standard
▪ Therefore, the first bit of Kn is the 14th bit of
CnDn, the second bit the 17th, and so on,
ending with the 48th bit of Kn being the 32th bit
Information Security

of CnDn.
34
November 2023
Data Encryption Standard
▪ Expansion Permutation
▪ Recall that after initial permutation, we had
two 32-bit plain text areas called Left Plain
Information Security

Text(LPT) & Right Plain Text(RPT).


▪ During the expansion permutation, the
RPT is expanded from 32 bits to 48 bits.
▪ Bits are permuted as well hence called
expansion permutation.
▪ This happens as the 32-bit RPT is divided
into 8 blocks, with each block consisting of
4 bits.
35
November 2023
Data Encryption Standard
▪ Then, each 4-bit block of the previous step is
then expanded to a corresponding 6-bit
block, i.e., per 4-bit block, 2 more bits are
Information Security

added.
36
November 2023
Data Encryption Standard
▪ This process results in expansion as well as a
permutation of the input bit while creating
output.
Information Security

▪ The key transformation process compresses


the 56-bit key to 48 bits.
▪ Then the expansion permutation process
expands the 32-bit RPT to 48-bits.
▪ Now the 48-bit key is XOR with 48-bit RPT
and the resulting output is given to the next
step, which is the S-Box substitution.
37
November 2023
Data Encryption Standard
▪ S-Box permutation
▪ After the block is mixed with the sub-key, it
is divided into eight 6-bit parts.
Information Security

▪ It provides additional security to the cipher.


▪ The S-box process uses a lookup table to
convert the eight 6-bit parts into 4-bit
output each, resulting in 32-bit output in
total.
38
November 2023
Data Encryption Standard
▪ P-Box permutation
▪ The 32-bit output from the S-box
permutation is rearranged according to the
Information Security

P-box permutation.
▪ The design of the P-box permutation
ensures that the output of each S-box is
spread across four different S-boxes for the
next round of encryption.
39
November 2023
Data Encryption Standard
▪ XOR and Swap
▪ XOR is a mathematical function that
compares two sets of bits that can be either
Information Security

1s or 0s.
▪ If the bits from both sets match, the XOR
output is 0.
▪ On the other hand, if they don’t match, the
output is 1.
▪ This bit-wise comparison results in
stronger encryption.
40
November 2023
Data Encryption Standard
◼ The process of decryption with DES is
essentially the same as the encryption process.
Information Security

◼ The rule is as follows:


◼ Use the cipher-text as input to the DES
algorithm, but use the sub-keys Ki in reverse
order.
◼ That is, use K16 on the first iteration, K15
on the second iteration, & so on.
End of Lesson 6

Question / Discussion?

You might also like