Shifting the index by 6 caused a reuse of one bit, leading to 4
different configurations instead of 8.
Shifting by 5 means we are using the 3 least significant bits of the
index, as was always intended.
// Maximise tweak diversity.
// We want to set the bits 1 (sign) and 6-7 (padding)
- u8 tweak = (u8)((i & 1) + (i << 6));
+ u8 tweak = (u8)((i & 1) + (i << 5));
u8 r[32];
if (crypto_curve_to_hidden(r, pkf, tweak)) {
continue; // retry untill success (doesn't increment the tweak)