You are on page 1of 3

Overview

Figure 1 illustrates the overall structure of the simplified DES, which we will refer to a SDES.
The S-DES encryption algorithm takes an 8-bit block of plaintext (examples:
10111101) and a 10-bit key as input and produces an 8-bit block of ciphertext as output.
The S-DES decryption algorithm takes an 8-bit block of ciphertext and the same 10-bit
key used to produce that ciphertext as input and produces the original 8-bit block of
plaintext.

The encryption algorithm involves five functions


An initial permutation (IP).
A complex function labeled fk, which involves both permutation and substitution
operations and depends on a key input.
A simple permutation function that switches (SW) the two halves of the data.
The function fk again.
A permutation function that is the inverse of the initial permutation (IP -1).
S-DES Key Generation
S-DES depends on the use of a 10-bit key shared between sender and receiver. From this
key, two 8-bit subkeys are produced for use in particular stages of the encryption and
decryption algorithm, see figure 2.
First, permute the key in the following fashion. Let the 10-bit key be designated as (k 1, k2,
k3, k4, k5, k6, k7, k8, k9, k10). Then the permutation P10 is defined as:
P10(k1, k2, k3, k4, k5, k6, k7, k8, k9, k10) = (k3, k5, k2, k7, k4, k10, k1, k9, k8, k6).

P10
3 5 2 7 4 10 1 9 8 6
Step 1: For example, the key (1010000010) is permuted to (1000001100).
Step 2: Divide (1000001100) into a left part 5-bit value (10000) and a right part 5-bit
value (01100).
Step 3: Perform a circular left shift (LS-1), or rotation, separately. The left value (10000)
becomes (00001). The right value (01100) becomes (11000). Concatenate the left part
(00001) and the right part (11000) into a 10-bit value (0000111000).
Step 4: Pick out and permutes 8, (don’t use 1 and 2), of the 10 bits according to the
following rules:
P8
6 3 7 4 8 5 10 9
The result is subkey k1. The value (00 00111000) becomes:
k1 = (10100100).
Step 5: Go back to the pair of 5-bit strings produced by the two LS-1 functions, the
results of step 3, and perform a circular left shift of 2 bit positions on each string. The left
value (00001) becomes (00100) and the right value (11000) becomes (00011).
Concatenate the left part (00100) and the right part (00011) into a 10-bit value
(0010000011).
Step 6: Finally, P8 is applied again to produce k 2, the value (00 10000011) becomes:
k2 = (01000011).
Initial and Final Permutations
The input to the algorithm is an 8-bit block of plaintext (10111101), which we first
permute using the IP function.
Step first: Permute the plaintext (10111101) with IP and the value becomes (01111110).
Divide the value into two parts. The left part becomes (0111) and the right part becomes
(1110).
IP
26314857
This retains all 8 bits of the plaintext but mixes them up. At the end of the algorithm, the
inverse permutation is used.
Step last: Permute the value (11101100) with IP -1 and the ciphertext becomes
(01110101).
IP-1
41357286
It is easy to show by example that the second permutation is indeed the reverse of the
first; that is, IP-1(IP(X)) = X.
The Function F and fk
The most complex component of S-DES is the function f k, which consists of a
combination of permutation and substitution functions, see figure 3.
fk(L,R) = (L ⊕F(R,SK),R)
function_F
function F = function_ff(key,R)
function_fk
function [L,R] = function_fk(key,L,R)
SK is a subkey, k1 or k2, and ⊕is the bit-by-bit exclusive-OR function.
Step 1:
First loop: Suppose the output of the IP stage is (01111110), the left 4-bit value is (0111)
and the right 4-bit value is (1110).
Second loop: The output of the SW stage is (11101100), the left 4-bit value is (1110) and
the right 4-bit value is (1100).
Step 2:
First loop: Expand the 4-bit value (1110) and concatenate it twice into an 8-bit value
(11101110).
Second loop: Expand the 4-bit value (1100) and concatenate it twice into an 8-bit value
(11001100).
Step 3:
First loop: Permute (11101110) and we have (01111101).
Second loop: Permute (11001100) and we have (01101001).
E/P
41232341
Step 4:
First loop: Create a matrix based on the result of step 3. Row 1 is (0111). Row 2 is
(1101).
n4 n1 n2 n3 0 1 1 1
n2 n3 n4 n1 1 1 0 1
Second loop: Create a matrix based on the result of step 3. Row 1 is (0110). Row 2 is
(1001).
n4 n1 n2 n3 0 1 1 0
n2 n3 n4 n1 1 0 0 1

Step 5:
First loop: Create a matrix based on the 8-bit subkey K 1 = (k11, k12, k13, k14, k15, k16, k17,
k18). We use the key (10100100).
k11 k12 k13 k14 1 0 1 0
k15 k16 k17 k18 0 1 0 0
Second loop: Create a matrix based on the 8-bit subkey K 2 = (k21, k22, k23, k24, k25, k26, k27,
k28). We use the key (01000011).
k21 k22 k23 k24 0 1 0 0
k25 k26 k27 k28 0 0 1 1
Step 6:
First loop: Perform an exclusive-OR function on the matrix in step 4 and step 5.
n4 ⊕k1 n1 ⊕k2 n2 ⊕k3 n3 ⊕k4
1101
n2 ⊕k5 n3 ⊕k6 n4 ⊕k7 n3 ⊕k8
1001
Second loop: Perform an exclusive-OR function on the matrix in step 4 and step 5.
n4 ⊕k1 n1 ⊕k2 n2 ⊕k3 n3 ⊕k4
0010
n2 ⊕k5 n3 ⊕k6 n4 ⊕k7 n3 ⊕k8
1010

You might also like