Recently, I was reading about Blake2B and its properties regarding randomness and security, and its connection to Daniel Bernstein's CHA CHA digest. As a budding cryptographer, I find it doable to implement those algorithms, but I find it very hard to grasp why the specific functions were chosen. From wikipedia, this is Blake2's mixing function:
Function Mix Inputs: Va, Vb, Vc, Vd four 8-byte word entries from the work vector V x, y two 8-byte word entries from padded message m Output: Va, Vb, Vc, Vd the modified versions of Va, Vb, Vc, Vd Va ← Va + Vb + x with input Vd ← (Vd xor Va) rotateright 32 Vc ← Vc + Vd no input Vb ← (Vb xor Vc) rotateright 24 Va ← Va + Vb + y with input Vd ← (Vd xor Va) rotateright 16 Vc ← Vc + Vd no input Vb ← (Vb xor Vc) rotateright 63 Result ← Va, Vb, Vc, Vd End Function Mix
The two most important questions I have are:
- How exactly did the designer come to these specific steps?
- How exactly did the designer come to the specific constants and more importantly - if I were to take some operation and change it slightly, how would it affect the security of the algorithm? If, for example, I were to rotate right by 61 instead of 63 and 25 instead of 24, how would it affect the security of the algorithm as a whole? Extension - how did the designer (and presumably many researchers) fine-tune these constants till they reached the final Blake2b?
I know, for a non-related instance, that choosing the right polynomial in these kinds of applications is very critical, but I do not see how any value could be called "optimal" in the above mentioned context - one value which may work well for some kinds of data may not work well with other kinds of data.
If possible, can you please explain it in an intuitive way, going if needed into technical details, very slowly? Any answer will be appreciated very much!