# What happens at this part in the key schedule of a Speck…?

I am trying to figure out the process behind the Speck block cipher. I understand how XOR works (Exclusive-or) when you take 2 strings of bits and you want to XOR them together.

However, in the key schedule of the cipher, there is a point where XOR takes place but I don t understand what is being XORed.

For example, in the key schedule in the link, the result of the binary addition is being XOR d with 0?

Can someone explain what this means? Thanks.

• It is round counter – hardyrama Sep 9 '18 at 15:01

## 1 Answer

For example, in the key schedule in the link, the result of the binary addition is being XOR d with 0?

It's very simple: In the key schedule, the exclusive-or step after the addition is done with the round counter, and the round counter starts at $0$ rather than $1$.

So for round number $0$, the first exclusive-or is done with the value $0$. In the next round, the exclusive-or is done with the value $1$, and so forth.

The supplied reference code might be easier to read than the block diagram, depending on your programming skills.

• So you're saying in the first round, that exclusive-or wouldn't change anything, but after that, you would XOR with 1, then 10, 11, 100, 110, 101... etc? Plus, I've only ever programmed in python. So I don't really understand the reference code. – Marc Hughes Sep 9 '18 at 15:37
• @MarcHughes Yes, that is correct. The round counter is being used as the round constants, and the job of the round constants is to ensure that each round is processed differently. As long as unique values are used for each round, then the purpose is fulfilled. On a different note: if you are interested in how cryptographic algorithms are programmed, you will benefit greatly if you study C. I love python as much as (if not more than!) the next person, but C is what most serious implementations are written in ("serious" meaning "intended for use to protect data in the real world"). – Ella Rose Sep 9 '18 at 16:10