isPrime

Check for primality using Miller-Rabin

static if(BOTAN_HAS_PUBLIC_KEY_CRYPTO)
bool
isPrime
()
(
auto const ref BigInt n
,,
size_t prob = 56
,
bool is_random = false
)

Parameters

n BigInt

a positive integer to test for primality

rng RandomNumberGenerator

a random number generator

prob size_t

chance of false positive is bounded by 1/2**prob

is_random bool

true if n was randomly chosen by us

Return Value

Type: bool

true if all primality tests passed, otherwise false

Meta