MCPcopy Create free account
hub / github.com/albertobsd/keyhunt / thread_bPload

Function thread_bPload

bsgsd.cpp:1963–2120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1961
1962
1963void *thread_bPload(void *vargp) {
1964
1965 char rawvalue[32];
1966 struct bPload *tt;
1967 uint64_t i_counter,j,nbStep,to;
1968
1969 IntGroup *grp = new IntGroup(CPU_GRP_SIZE / 2 + 1);
1970 Point startP;
1971 Int dx[CPU_GRP_SIZE / 2 + 1];
1972 Point pts[CPU_GRP_SIZE];
1973 Int dy,dyn,_s,_p;
1974 Point pp,pn;
1975
1976 int i,bloom_bP_index,hLength = (CPU_GRP_SIZE / 2 - 1) ,threadid;
1977 tt = (struct bPload *)vargp;
1978 Int km((uint64_t)(tt->from + 1));
1979 threadid = tt->threadid;
1980
1981
1982 i_counter = tt->from;
1983
1984 nbStep = (tt->to - tt->from) / CPU_GRP_SIZE;
1985
1986 if( ((tt->to - tt->from) % CPU_GRP_SIZE ) != 0) {
1987 nbStep++;
1988 }
1989 to = tt->to;
1990
1991 km.Add((uint64_t)(CPU_GRP_SIZE / 2));
1992 startP = secp->ComputePublicKey(&km);
1993 grp->Set(dx);
1994 for(uint64_t s=0;s<nbStep;s++) {
1995 for(i = 0; i < hLength; i++) {
1996 dx[i].ModSub(&Gn[i].x,&startP.x);
1997 }
1998 dx[i].ModSub(&Gn[i].x,&startP.x); // For the first point
1999 dx[i + 1].ModSub(&_2Gn.x,&startP.x);// For the next center point
2000 // Grouped ModInv
2001 grp->ModInv();
2002
2003 // We use the fact that P + i*G and P - i*G has the same deltax, so the same inverse
2004 // We compute key in the positive and negative way from the center of the group
2005 // center point
2006
2007 pts[CPU_GRP_SIZE / 2] = startP; //Center point
2008
2009 for(i = 0; i<hLength; i++) {
2010 pp = startP;
2011 pn = startP;
2012
2013 // P = startP + i*G
2014 dy.ModSub(&Gn[i].y,&pp.y);
2015
2016 _s.ModMulK1(&dy,&dx[i]); // s = (p2.y-p1.y)*inverse(p2.x-p1.x);
2017 _p.ModSquareK1(&_s); // _p = pow2(s)
2018
2019 pp.x.ModNeg();
2020 pp.x.ModAdd(&_p);

Callers

nothing calls this directly

Calls 11

bloom_addFunction · 0.85
AddMethod · 0.45
ComputePublicKeyMethod · 0.45
SetMethod · 0.45
ModSubMethod · 0.45
ModInvMethod · 0.45
ModMulK1Method · 0.45
ModSquareK1Method · 0.45
ModNegMethod · 0.45
ModAddMethod · 0.45
Get32BytesMethod · 0.45

Tested by

no test coverage detected