In Simplified DES algorithm, the plain text is 8-bit & the key is 10-bit, why is that, why can't both be of 8-bits each?
If you're talking about the S-DES developed by Professor Edward Schaefer of Santa Clara University, I can try to explain you the reason.
The algorithm takes in input a 10-bit key (K) but, using a key generation algorithm, the plaintext is encrypted using two different subkeys (K1 and K2) that are generated by the algorithm.
First, you should pass the 10-bit key through a permutation phase.
To generate K1 follow the following steps:
- split the key in two binary string with the same length
- pass to a simple left shift function (shift=1) both the keys and then join them again
- pass the key (still 10 bits long) through a reduction-permutation function(P8) that simply picks out and permutes 8 of the 10 bits. The P8 function works according to the following rule: 6 3 7 4 8 5 10 9
An example: assuming that the output of the left shift functions is the 10-bit key 0000111000, then the output of P8 function would be 10100100.
The output of (3) is K1, the key that will be used during the first round of the encryption procedure.
Now, to find K2 the procedure is practically the same:
- the input to (1) is not the initial key (K) nor K1, but it is the 10-bits key that comes from the left shift function used to find K1. Thus, after you've splitted this key in two equal length substrings, pass them through the left shift function (shift=2). Note the different shift value
- after you've joined the substrings again, pass the resulting 10-bits key to the P8 function to get K2.
Note: the initial permutation phase (P10) takes in input the initial 10-bit key and get us the 10 bits permuted according to the following rule: 3 5 2 7 4 10 1 9 8 6 The difference between P10 and P8 is only that P8 permutes only some bits while, P10, permutes all the 10 bits.
Hope I was helpful!