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.

Link: https://en.wikipedia.org/wiki/Speck_(cipher)#/media/File:Speck_block_cipher_0_indexing.svg

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.

  • $\begingroup$ It is round counter $\endgroup$
    – hardyrama
    Sep 9, 2018 at 15:01

1 Answer 1


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.

  • $\begingroup$ 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. $\endgroup$ Sep 9, 2018 at 15:37
  • 2
    $\begingroup$ @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"). $\endgroup$
    – Ella Rose
    Sep 9, 2018 at 16:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.