Computer Security
CPIS 312 Lab 6 & 7
Symmetric key
cryptography
TRIGUI Mohamed Salim
1
Lab Objectives
2
Lab Outcomes
3
Feistel Cipher
The input is a 64-bit data
element x.
Key k1, k2, … k16 for round
R1, R2, … R16 respectively.
Output: Cipher text
Divide x into two 32-bit
halves: L & R
For i=1 to 16
4
Feistel Cipher
M=0100 1100 K1=1 2 3 4
L0 R0 3421
i=1
R1=L0 Fk1(R0) R1=0100 Fk1 (1100)
R1=0100 0011=0111
R0=L1 L1=1100
i=2 K2=1 2 3 4
4312
R2=L1 Fk2(R1) R2=1100 Fk2 (0111)
R2=1100 1110=0010
R1=L2 L2=0111
C=0111 0010
L2 R2 5
Data Encryption Standard (DES)
6
7
Data Encryption Standard (DES)
The following figure illustrates the processes
that take place within each cycle, note that
these processes are repeated in the same way
in each sixteen cycles.
8
Data Encryption Standard (DES)
1. Initial Permutation (IP): To encode the text is
divided into blocks, each block consists of 64-bit,
the block entry to primary permutation,
permutation is the process - through which to
change the location of each bit of the block -
according to the relationship described in the
following figure:
9
Data Encryption Standard (DES)
The table represents the order of each bit in the
block after the primary permutation. This
arrangement is fixed in this algorithm, which is
proposed by those who have designed, and must
follow this arrangement so that decryption is
possible.
11
Data Encryption Standard (DES)
3. Expansion and Permutation: In this step the
right half which consists of 32-bits is expanded, to
become a 48-bits and permutation process is
conducted at the same time, according to the
relationship described in the following figure:
12
Data Encryption Standard (DES)
The following table represents the order of each bit
after the expansion and permutation and shows the
source of each added bit.
14
Data Encryption Standard (DES)
The table represents the order of each bit after the
process of permutation and reducing.
15
Data Encryption Standard (DES)
5. Key Permutation: In this step two halves of
the left and right key are merged the key is
reduced and permuted to turn from the 56-bit to
48-bit as the relationship described in the following
figure:
16
Data Encryption Standard (DES)
The table represents the order of each bit after the
reducing and permutation.
17
Data Encryption Standard (DES)
6. Substitution Permuted Choice s-box: The
output of the previous operations which is
consisted of 48-bit, is converted to, 32-bit and
permuted.
19
Data Encryption Standard (DES)
3. Take the second, third, fourth and fifth bits (in
our example 0110) which represents the column
number in s-box table (S1) which equals 6.
4. The result is the intersection of row 2 with
column 6 in the table of (S1), a number 2
decimal system is equal to 0010 in binary
system, i.e. the entered value of the (S1)
101100 became 0010
5. Repeat the previous steps for each block with
the corresponding s-box
20
Data Encryption Standard (DES)
The following table in the next slide contains the
values of each s-box, note that the numbers of
rows and columns starting from zero, i.e. the first
row to be selected when the output of the
concatenation of the first bit and the second
equals zero.
21
Data Encryption Standard (DES)
22
Data Encryption Standard (DES)
7. Permutation: The output of the previous step is
permuted, according to the relationship described
below
23
Data Encryption Standard (DES)
For further clarification of the previous relationship
the following table represents the output of the
permutation process.
24
Data Encryption Standard (DES)
8. New Right Data half: This step contains the
new right half, which is resulted through entering
the output of the seventh step and the left half on
logic gate (XOR). The output is the new right half
that will be used in the next cycle.
25
Data Encryption Standard (DES)
9. New Left Data half: The new left half is the
right half of the previous step, this step can be
shown in the following equations:
26
Data Encryption Standard (DES)
10. Final Permutation: After the end of the
sixteen cycles, the output that is the right half of
the last cycle is taken and concatenated with the
left half of the last cycle, to form the final output.
The final output consists of 64-bits, final
permutation is conducted to the final output as the
relationship described in the following figure:
27
Data Encryption Standard (DES)
For further clarification of the previous relationship
the following table represents the output of the
process of final permutation which represents the
encoded text.
28
Example 1
The following permutation table is used to
permute an 8-bit input:
IP = [3 7 2 8 1 5 4 6]
A. Draw the internal connections of both the
corresponding IP-box and the inverse IP-box
(IP-1 -box).
B. Find the inverse permutation table IP-1.
29
Example 1
30
Example 1
31
Example 2
The following input is applied to the eight S-boxes
(S1: S8) of the DES algorithm. The input is
specified as eight 6 bits hexadecimal numbers.
Find the corresponding 32 bits output and specify
it as a hexadecimal number.
3E 19 0F 24 1D 2A 39 2B
3 E =11 1110
Row : 10
Column: 1111
intersection using S0 box in the following table: 13
=D
32
Example 2
The following input is applied to the eight S-boxes
(S1: S8) of the DES algorithm. The input is
specified as eight 6 bits hexadecimal numbers.
Find the corresponding 32 bits output and specify
it as a hexadecimal number.
3E 19 0F 24 1D 2A 39 2B
3 E =11 1110
Row : 10
Column: 1111
intersection using S0 box in the following table: 13
=D
33
Example 2
35