17template <
typename Params>
18class Secp256k1Rep
final {
20 static constexpr auto P = Params::P;
21 static constexpr size_t N = Params::N;
22 typedef typename Params::W W;
26 static constexpr W C = 0x1000003d1;
28 constexpr static std::array<W, N> one() {
return std::array<W, N>{1}; }
30 constexpr static std::array<W, N> redc(
const std::array<W, 2 * N>& z) {
34 constexpr static std::array<W, N> to_rep(
const std::array<W, N>& x) {
return x; }
36 constexpr static std::array<W, N> wide_to_rep(
const std::array<W, 2 * N>& x) {
return redc(x); }
38 constexpr static std::array<W, N> from_rep(
const std::array<W, N>& z) {
return z; }
42class Params
final :
public EllipticCurveParameters<
43 "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F",
46 "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141",
47 "79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798",
48 "483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8"> {
52#if BOTAN_MP_WORD_BITS == 64
53typedef EllipticCurve<Params, Secp256k1Rep> Secp256k1Base;
55typedef EllipticCurve<Params> Secp256k1Base;
58class Curve
final :
public Secp256k1Base {
61 static FieldElement fe_invert2(
const FieldElement& x) {
67 auto t1 = t0.square();
102 static Scalar scalar_invert(
const Scalar& x) {
113 auto t4 = z.square();
121 auto t11 = t10.square();
122 auto t8 = t11.square();