S Des
S Des
S Des
1
function that is the inverse of the initial permutation (IP-1). Decryption
process is similar.
The function fK takes 8-bit key which is obtained from the 10-bit initial one
two times. The key is first subjected to a permutation P10. Then a shift
operation is performed. The output of the shift operation then passes through
a permutation function that produces an 8-bit output (P8) for the first subkey
(K1). The output of the shift operation also feeds into another shift and
another instance of P8 to produce the 2nd subkey K2.
We can express encryption algorithm as superposition:
IP 1 o f K 2 o SW o f K1 o IP
or
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))))
2
S-DES KEY GENERATION
3
Each position in this table gives the identity of the input bit that produces the
output bit in this position. So, the 1st output bit is bit 3 (k3), the 2nd is k5
and so on. For example, the key (1010000010) is permuted to (1000001100).
Next, perform a circular shift (LS-1), or rotation, separately on the 1st 5 bits
and the 2nd 5 bits. In our example, the result is (00001 11000)
Next, we apply P8, which picks out and permutes 8 out of 10 bits according
to the following rule:
P8
6 3 7 4 8 5 10 9
The result is subkey K1. In our example, this yields (10100100)
We then go back to the pair of 5-bit strings produced by the 2 LS-1 functions
and perform a circular left shift of 2 bit positions on each string. In our
example, the value (00001 11000) becomes (00100 00011). Finally, P8 is
applied again to produce K2. In our example, the result is (01000011)
4
S-DES ENCRYPTION
5
IP-1
41357286
The S-boxes operate as follows. The 1st and 4th input bits are treated as a 2-
bit number that specify a row of the S-box, and the 2nd and 3rd input bits
specify a column of the S-box. The entry in that row and column, in base 2, is
the 2-bit output. For example, if (p00, p03) = (00) and (p01, p02) = (10),
then the output is from row 0, column 2 of S0, which is 3, or (11) in binary.
6
Similarly, (p10, p13) and (p11, p12) are used to index into a row and column
of S1 to produce an additional 2 bits.
Next, the 4 bits produced by S0 and S1 undergo a further permutation as
follows:
P4
2431
The output of P4 is the output of function F.
The function fK only alters the leftmost 4 bits of input.
The switch function SW interchanges the left and right bits so that the 2nd
instance of fK operates on a different 4 bits. In the 2nd instance, the E/P, S0,
S1, and P4 functions are the same. The key input is K2.