# How is overflow handled in word addition steps in Salsa20?

I feel like I'm completely missing something there. The quarter-round proceeds as follows:

b ^= (a + d) <<< 7;
c ^= (b + a) <<< 9;
d ^= (c + b) <<< 13;
a ^= (d + c) <<< 18;


So at each step, we're adding words a, b, c, d together. And at the end of 20 quarter-rounds, we add the current state matrix with the previous state.

What I don't see is how overflows are handled. If two words added exceed the value of a word, does it simply wrap around?

• The additions are modulo $2^{32}$. – fgrieu Feb 5 '19 at 22:57

Adding two uint32s and ignoring the carry / overflow is equivalent to performing addition modulo 232.