Implement num.h
API without GMP backend; benchmarks show modular inversion taking about 65% longer than with GMP, but much faster than the constant-time version.
I will update this PR with an implementation of the Jacobi symbol computation; for now I’m pushing it in the hopes that somebody will see some more perf improvements that will let us catch up with GMP. (In fact, since we don’t require arbitrary size numbers or allocation we should in principle be able to beat them..). This has a modular inverse but no Jacobi symbol.
This is required for https://github.com/bitcoin/secp256k1/pull/262 because we do not want to require a GMP dependency.
Edit: I have a paper by the author of the GMP code which describes (mostly) what they are doing. With this I am able to read the GMP code; I think I see how to optimize it for our special case. So we should hold off any detailed review until I’ve written new gcd code.