private PolyMod ( int x, System.Numerics.BigInteger PolyNomial, System.Numerics.BigInteger Modulus ) : System.Numerics.BigInteger | ||
x | int | |
PolyNomial | System.Numerics.BigInteger | |
Modulus | System.Numerics.BigInteger | |
return | System.Numerics.BigInteger |
BigInteger PolyMod(int x, BigInteger[] PolyNomial, BigInteger Modulus) {
int Power = 1; // expect the optimizer to catch
BigInteger Result = PolyNomial[0];
for (int i = 1; i < PolyNomial.Length; i++) {
Power = Power * x;
Result = (Modulus + Result + PolyNomial[i] * Power) % Modulus;
}
return Result;
}