## The DES f-Function for 32 rightmost bits

****
##### ### The f-function is defined as follows: Expansion of Ri-1 XOR-ing the extracted key and the expanded R Division to 8 6bits blocks Reduction substitution of the 6bits blocks to 4 bits blocks concatenation of the 8 4bits blocks. permutation Expansion of the 32 rightmost bits Build the 48bits expanded list by the following transposition where some bits participate more than once, enabling the 32 to 48 bits expansion: Use the following order: 32, 1, 2, 3, 4, 5, 4, 5, 6, 7, 8, 9, 8, 9, 10, 11, 12, 13, ...... 30, 31, 32, 1 Namely, the 32nd bit in the R string becomes the first bit in the expanded string, ER XORing the derived 48bits key with the expanded rightmost bits The two 48 bits string are bit-wise XOR-ed to yield a single 48 bits string. Division of the 48bits XORed string to 8 6bits blocks The 48 bits product of the XOR process is divided to ordered 8 blocks of 6bits each. Reduction substitution of the 6bits blocks to 4 bits blocks Each 6 bits block is substituted by 4 bits sequence according to the following procedure: Use 8 guiding tables, for blocks: 1, 2,...8, where each table is comprised of 16 columns and 4 rows. The integer that corresponds to bit 1 concatenated with bit 6 (0,1,2,3) determines the row to read from, and the integer that corresponds to the concatenation of bits: 2,3,4,5 (0,1,2,...15) determines the column. The table identifies a 4 bits sequence at the set row and column, that is the the 4 bits strings that substitutes for the input 6 bits string. Table 1 looks like: ``` 14 4 13 1 2 15 11 8 3 10 6 12 5 9 0 7 0 15 7 4 14 5 3 8 4 1 14 10 5 0 15 12 8 0 6 13 ``` Concatenation of the 8 4bits blocks The 8 bits blocks are then concatenated to form a 32 bits string that becomes the new right most block of the processed plaintext, Ri. Permutation Round The following permutation round is omitted in the international version of DES, namely DEA. The concatenated 32bits sequence is transposed according to the following procedure: 16, 17, 20, 21, 29, 12, 28, 17,.... 11, 4, 25 resulting in the final 32 bits sequence, the output of the f function..
* Version CE-H6703 (SERVER) Crypto Academy