Cryptography Reference
In-Depth Information
Finally, the halves are swapped one last time, and the output is subject to the
inverse of the initial permutation — this just undoes what the initial permuta-
tion did.
NOTE The specifi cation suggests that you should implement this last step by
just not swapping in the last round; the approach presented here is a bit simpler
to implement and the result is the same.
The fi nal permutation table is show in Listing 2-6.
Listing 2-6: “des.c” fi nal permutation table
/**
* This just inverts ip_table.
*/
static const int fp_table[] = { 40, 8, 48, 16, 56, 24, 64, 32,
39, 7, 47, 15, 55, 23, 63, 31,
38, 6, 46, 14, 54, 22, 62, 30,
37, 5, 45, 13, 53, 21, 61, 29,
36, 4, 44, 12, 52, 20, 60, 28,
35, 3, 43, 11, 51, 19, 59, 27,
34, 2, 42, 10, 50, 18, 58, 26,
33, 1, 41, 9, 49, 17, 57, 25 };
There are several details missing from the description of the rounds. The
most important of these details is what's termed the key schedule .
DES Key Schedule
In the description of step 2 of the rounds, it states “XOR the expanded right
half of the input with the key.” If you look at the diagram, you see that the
input to this XOR is shown as K1, K2, K3, ... K15, K16. As it turns out, there are
16 different 48-bit keys, which are generated deterministically from the initial
64-bit key input.
The key undergoes an initial permutation similar to the one that the input
goes through, with slight differences — this time, the fi rst byte of the out-
put is equal to the fi rst bits of each input byte (again, backward); the second
byte is equal to the second bit of each input byte; and so on. However, the
key itself is specifi ed as two 28-bit halves — the second half works backward
through the input bytes so that the fi rst byte of the second half is the seventh
bit of each input byte; the second byte is the sixth bit; and so on. Also, because
the key halves are 28 bits each, there are only three and a half bytes; the last
half byte follows the pattern but stops after four bits. Finally, although the
key input is 8 bytes (64 bits), the output of two 28-bit halves is only 56 bits.
 
Search WWH ::




Custom Search