Template Function lbcrypto::WitnessFunction

Function Documentation

template<typename IntType>
static bool lbcrypto::WitnessFunction(const IntType &a, const IntType &d, uint32_t s, const IntType &p)

A witness function used for the Miller-Rabin primality test.

Parameters
  • a – a randomly generated witness between 2 and p-1

  • d – the odd factor with p-1 = 2^s * d

  • s – the power of two with p-1 = 2^s * d

  • p – the number to be tested for primality

Returns

true if p is composite, false if p is likely prime