RSAKeyPairGenerator.millerRabinBase

private BigInt millerRabinBase(const(ubyte)[] buf, BigInt n) static

Maps random octets to a Miller-Rabin witness base.

The base is reduced into [2, n-2]: reducing modulo n-3 (rather than n-2) keeps the degenerate witness a = n-1 out of the pool, since (-1)^d is always +-1 and proves nothing.

Parameters

bufFresh random octets.
nThe odd candidate under test (n > 4).

Returns

A witness base a with 2 <= a <= n-2.