RC6 Key Size Understanding I need help to understand how RC6 works. Many sites show that the maximum key size of RC6 is 2040 bits (255 Bytes). I can also have 0..255 rounds and 4 times 32bits words in the 128bit block variant or 4 times 64 bits Words in 256 bit variant. For this question assume 20 rounds

If expansion massive S[0,�,2r + 3]  => max = 2*20+3=43 * 4bytes = 172bytes. If it is really possible to have a key consist of up to 255 bytes then array S is too small. Where does my calculation go wrong?



Input: User-supplied b byte key preloaded into the c - word array L[0,�,c-1]

Number r of rounds 

Output: w-bit round keys S[0,�,2r + 3] 

Procedure:

S[0] = Pw 
for i = 1 to 2r + 3 do 
    S[i]=S[i-1]+Qw 

A=B=i=j=0 
v=3 ? max{c, 2r+4} 

for s=1 to v do
{ 
    A=S[i]=(S[i]+A+B)&lt;&lt;ɛ 
    B=L[j]=(L[j]+A+B)&lt;&lt;&lt;(A+B) 
    i=(i+1) mod (2r+4) 
    j=(j+1) mod c
}
[Copy of my answer in another community:] In the RC6 specification (see de.wikipedia.org/wiki/RC6) S[*] designates an array of 2r+4 round keys, whose size in bits you can choose in the range [0,2000]. It is not an array of 2r+4 elements (each a word of 4 bytes).