MCPcopy Create free account
hub / github.com/JeanLucPons/VanitySearch / DoubleDirect

Method DoubleDirect

SECP256K1.cpp:937–965  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

935}
936
937Point Secp256K1::DoubleDirect(Point &p) {
938
939 Int _s;
940 Int _p;
941 Int a;
942 Point r;
943 r.z.SetInt32(1);
944
945 _s.ModMulK1(&p.x,&p.x);
946 _p.ModAdd(&_s,&_s);
947 _p.ModAdd(&_s);
948
949 a.ModAdd(&p.y,&p.y);
950 a.ModInv();
951 _s.ModMulK1(&_p,&a); // s = (3*pow2(p.x))*inverse(2*p.y);
952
953 _p.ModMulK1(&_s,&_s);
954 a.ModAdd(&p.x,&p.x);
955 a.ModNeg();
956 r.x.ModAdd(&a,&_p); // rx = pow2(s) + neg(2*p.x);
957
958 a.ModSub(&r.x,&p.x);
959
960 _p.ModMulK1(&a,&_s);
961 r.y.ModAdd(&_p,&p.y);
962 r.y.ModNeg(); // ry = neg(p.y + s*(ret.x+neg(p.x)));
963
964 return r;
965}
966
967Point Secp256K1::Double(Point &p) {
968

Callers 2

VanitySearchMethod · 0.80
GenerateCodeMethod · 0.80

Calls 6

SetInt32Method · 0.80
ModMulK1Method · 0.80
ModAddMethod · 0.80
ModNegMethod · 0.80
ModSubMethod · 0.80
ModInvMethod · 0.45

Tested by

no test coverage detected