I'm implementing the Twofish algorithm for use in educational software. Im using QT for UI and using research from Wikipedia and the Twofish paper of Bruce Schneier, but Im stuck on generating the whitening subkeys. I've successfuly understood how to generate round subkeys, but haven't found the way to generate whitening ones.
I'm taking k = 2 (128 bit key, 128/64 = 2), so, 2k = 4; size of M_e and M_0 is 2, I'm filling them from original key and calculating round keys for 16 rounds, 2 key per each.
So, instead of 40 subkeys I'm getting only 32.
Where I've missed the 8 for whitening? I've re-read the paper and didn't find an algorithm for them, or suggestion's on how they're generated like first or last N keys before or after the round ones.
How do i generate the whitening keys?