Compilation time calculated modular exponent
Function that calculates modular exponent at compile time
Input parameters are limited to the folowing values:
0 < base < 109 (1 000 000 000)
0 < power < 106 (1 000 000)
0 < modulus < 109 (1 000 000 000)
Example usage:
#include "static_modexp.hpp"
constexpr auto result = power_mod(INIT_ARGS(8734246, 9786, 5647389));
Running unit tests:
cmake .
make test_ok
make test_base_nok
make test_power_nok
make test_modulus_nok