Vitc Bcse309l m2 l2 S Des

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

Simplified DES:

S-DES, that is, Simplified DES, has similar properties and structure to DES with much
smaller parameters.

Figure C.1 illustrates the overall structure of the simplified DES, which we will refer to as
SDES.

Figure C.1: Simplified DES Scheme

 The S-DES encryption algorithm takes


• 8-bit block of plaintext
• 10-bit key as input
• Produces an 8-bit block of ciphertext as output.

 The S-DES decryption algorithm takes


• 8-bit block of ciphertext
• 10-bit key used to produce that ciphertext as input
• Produces the original 8-bit block of plaintext.

 The encryption algorithm involves five functions:


• An initial permutation (IP);

1
• A complex function labeled fK, which involves both permutation and substitution
operations and depends ona 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).

• We can concisely express the encryption algorithm as a composition of functions:

IP −1 o f K 2 o SW o f K1 o IP

which can also be written as

Ciphertext= IP-1 ( f K 2 ( SW ( f K1 ( IP ( pla int ext )))))

where

K1 = P8( Shift ( P10(key )))

K 2 = P8( Shift ( Shift ( P10(key))))

 Decryption is the reverse of encryption as shown in Figure C.1:

Plaintext= IP-1 ( f K1 ( SW ( f K 2 ( IP (ciphertext )))))

NOTE:

Definition: If f and g are two functions, then the function F with the equation y = F(x) = g[f(x)] is
called the composition of f and g and is denoted as F = g o f .

 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 sub keys are produced for use in particular stages of the
encryption and decryption algorithm as shown in figure C.2

2
Figure C.2: Key Generation for SDES

• The 10-bit key is designated as (k1, 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 can be concisely defined by the display:

NOTE: Refer the example below this explanation to understand S-DES properly.

• Now perform a circular left shift (LS-1), or rotation, separately on the first five bits and
the second five bits.

• Next apply P8, which picks out and permutes 8 of the 10 bits according to the following
rule:

3
• The result is sub key 1 (K1).

• Further, on each of the 5-bit strings produced by the two LS-1 functions, a circular left
shift of 2 bit positions is performed.

• Finally, P8 is applied again to produce sub key K2.

 SDES Encryption:
Encryption involves the sequential application of five functions as shown in figure C.3:

• Initial Permutations:

The input to the algorithm is 8-bit block of plaintext, which are first permuted using the IP
function:

This retains all 8 bits of the plaintext but mixes them up.

• The Function fK

The most complex component of S-DES is the function fK, which consists of a combination
of permutation and substitution functions.

The functions can be expressed as follows:

Let L and R be the leftmost 4 bits and rightmost 4 bits of the 8-bit input to fK.

Let F be a mapping from 4-bit strings to 4-bit strings. Then,

Where SK is a sub key and is the bit-by-bit exclusive-OR function.

4
The mapping F can be described as follows:

o The input is a 4-bit number, R, the rightmost 4 bits of the 8-bit input to fK.

o The first operation is an expansion/permutation operation on this R. After expansion,


8-bit number is produced from the 4-bit number.

o The 8-bit sub key K1 = (k11, k12, k13, k14, k15, k16, k17, k18) is added to this value
using exclusive-OR, producing new 8-bit output.

o The first 4 bits are fed into the S-box S0 to produce a 2- bit output, and the remaining
4 bits are fed into S1 to produce another 2-bit output.

o The S-boxes operate as follows. The first and fourth input bits are treated as a 2-bit
number that specify a row of the S-box, and the second and third input bits specify a
column of the S-box. The entry in that row and column, in base 2, is the 2-bit output.

The 4 bits produced by S0 and S1 undergo a further permutation as follows:

The output of P4 is the output of the function F.

• The Switch Function

The function fK only alters the leftmost 4 bits of the input. The switch function (SW)
interchanges the left and right 4 bits so that the second instance of fK operates on a different 4
bits.

In this second instance, the E/P, S0, S1, and P4 functions are the same. The only difference is
that the key input is K2.

• Final Permutations
At the end of the algorithm, the following inverse permutation is used on the 8-bits at hand:

NOTE: It is advisable to write P10, P8, IP and IP-1 values as shown here. However, if
you forget those values, do not write wrong ones. Just mention which operation is
performed.

5
Figure: SDES Encryption details

6
NOTE:

Renaming these 8 bits:

P0,0, P0,1, P0,2 and P0,3 are fed into the S-box S0 to produce a 2- bit output,
The remaining 4 bits (P1,0, P1,1, P1,2 and P1,3) are fed into S1 to produce another 2-bit output.

These two boxes are defined as follows:

The S-boxes operate as follows:

The first and fourth input bits are treated as a 2-bit number that specify a row of the S-box,
and the second and third input bits specify a column of the S-box. The entry in that row and
column, in base 2, is the 2-bit output.

EXAMPLE (Merely for better understanding of S-DES):

GIVEN:

7
Plain Text- 10111101
Key- 1010000010

METHOD:

Obtaining K1 & K2 from main key:

1) Applying P10 on key, we get: 1000001100

2) Applying Circular left shift by 1 bit on two 5 bits part, we get: 0000111000

3) Applying P8, we get K1=10100100

4) Applying Circular left shift by 2 bits on step no. 2, we get: 0010000011

5) Applying P8, we get K2=01000011

Now we have: PT=10111101


Key=1010000010
` K1=10100100
K2=01000011

Steps for S-DES Encryption:

1) Initial permutation on plain text: IP(PT) = 01111110

2) Now applying fk1 on 0111 1110:

fk1(01111110) = [(0111) XOR (F(1110,sk)) ,(1110)]

For the above, we need to calculate F(1110,sk) using K1:

i) Apply E/P on 1110 we get: 0111 1101


ii) XOR with K1:11011001
iii) Pass 1101 to S0 box and we get : 11
iv) Pass 1001 to S1 box and we get : 10
v) Combining both results from S-boxes we get : 1101
vi) Then applying P4 on it we get : 1011

This is our required F, that is, F(1110, sk) = 1101

Now for:
fk1 (01111110) = [(0111) XOR (F(1110, K1)), (1110)]
= [(0111) XOR 1101), (1110)]
= [(1100), (1110)]

Now we have as an intermediary output: 1100 1110

8
3) Applying SW we get: 1110 1100

4) Now applying fk2 on 1110 1100:

fk2(11101100) = [(1110) XOR (F(1100,sk)) ,(1100)]

For the above we need to calculate F(1100,sk) by K2:

i) Apply E/P on 1100 we get: 0110 1001


ii) XOR with K2: 0010 1010
iii) Pass 0010 to S0 box and we get: 00
iv) Pass 1010 to S1 box and we get: 00
v) Combining both results from boxes’ we get : 0000
vi) Then Apply p4 on it we get: 0000

This is our required F, that is F(1100, sk) = 0000


Now for:

fk2 (11101100) = [(1110) XOR (F(1100, K2)), (1100)]

= [(1110) XOR 0000), (1100)]

= [(1110), (1100)]

Now we have at the end: 1110 1100

5) Apply IP-1 on it we get: 0111 0101 which is our Cipher Text

CT= 01110101

Practice Problems

1) Let the 8 - bits plain text be 10010111 and the 10 - bits key be
1010000010. Compute the cipher text using the Simplified - DES
algorithm.

2) Let the 8 - bits plain text be 00101000 and the 10 - bits key be
1100011110. Compute the cipher text using the Simplified - DES
algorithm.

You might also like