# DES key expansion: why are these two descriptions different?

I would like someone to explain me how to generate DES subkeys, because in the documentation that I saw, sometimes they say:

"We rotate the initial key according to the number of iterations given by this sequence: 1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28."

and sometimes they say:

"The two halves are each rotated to the left by an amount depending on the iteration stage, in the following order: 1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1."

Do you have any idea why these descriptions are different?

-

## migrated from stackoverflow.comJan 2 '13 at 16:11

This question came from our site for professional and enthusiast programmers.

Why are you using DES? We're not in the 70s anymore. – Ilmari Karonen Dec 28 '12 at 18:50
only, in the school, the teacher – simonTifo Dec 28 '12 at 19:22

I'm not going to look up the DES key schedule such, but the connection between your two sequences

$$( a_i ) = ( 1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28 )$$

and

$$( b_i ) = ( 1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1 )$$

is obvious: $b_i = a_i - a_{i - 1}$ (with $a_0$ taken to be 0).

That is, the second sequence gives the difference between successive elements of the first sequence.

Edit: OK, I did look it up, see link above. Basically, the first sequence gives the number of bits by which the halves of the original key need to be rotated to obtain the $i$-th subkey, whereas the second sequence gives the number of bits by which the halves of the previous subkey need to be rotated to obtain the next one. That's all there is to it.

-
thank you :), you are right – simonTifo Dec 28 '12 at 20:31