Say I have a field $\mathbb{F}_q$ for prime modulus $q$, and I have a function random() that yields a uniformly random element of $\mathbb{F}_q$ in constant time.
How would you efficiently build a function random_non_zero() that yields a uniformly random element of $\mathbb{F}_q^* = \mathbb{F}_q - \{0\}$ in constant time?
If needed, we can employ additional functions / relations / restrictions (e.g., uniformly random bit generation, access to a mod q function, etc...).
To the best of my knowledge:
- Reject sampling is not constant-time.
- A straightforward method is to sample a big enough number, reduce it
mod {q-1}, then add 1. However, most field implementations in the wild only provide efficientmod qoperations.
Can we sample non-zero values without computing mod q-1?