Multiplicative inverse #
The nonzero elements of GF(2⁸) form a group of order 255, so a²⁵⁵ = 1 and a⁻¹ = a²⁵⁴ for
a ≠ 0. We compute a²⁵⁴ with a fixed chain of squarings and multiplications
(254 = 2 + 4 + 8 + 16 + 32 + 64 + 128), so the sequence of operations never depends on a.
In qedshare, inv is only applied to public share indices (README: Threat model), but
being constant-time costs nothing here. By this definition inv 0 = 0.