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

Function thread_bPload

keyhunt.cpp:4404–4592  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4402DWORD WINAPI thread_bPload(LPVOID vargp) {
4403#else
4404void *thread_bPload(void *vargp) {
4405#endif
4406
4407 char rawvalue[32];
4408 struct bPload *tt;
4409 uint64_t i_counter,j,nbStep,to;
4410
4411 IntGroup *grp = new IntGroup(CPU_GRP_SIZE / 2 + 1);
4412 Point startP;
4413 Int dx[CPU_GRP_SIZE / 2 + 1];
4414 Point pts[CPU_GRP_SIZE];
4415 Int dy,dyn,_s,_p;
4416 Point pp,pn;
4417
4418 int i,bloom_bP_index,hLength = (CPU_GRP_SIZE / 2 - 1) ,threadid;
4419 tt = (struct bPload *)vargp;
4420 Int km((uint64_t)(tt->from + 1));
4421 threadid = tt->threadid;
4422 //if(FLAGDEBUG) printf("[D] thread %i from %" PRIu64 " to %" PRIu64 "\n",threadid,tt->from,tt->to);
4423
4424 i_counter = tt->from;
4425
4426 nbStep = (tt->to - tt->from) / CPU_GRP_SIZE;
4427
4428 if( ((tt->to - tt->from) % CPU_GRP_SIZE ) != 0) {
4429 nbStep++;
4430 }
4431 //if(FLAGDEBUG) printf("[D] thread %i nbStep %" PRIu64 "\n",threadid,nbStep);
4432 to = tt->to;
4433
4434 km.Add((uint64_t)(CPU_GRP_SIZE / 2));
4435 startP = secp->ComputePublicKey(&km);
4436 grp->Set(dx);
4437 for(uint64_t s=0;s<nbStep;s++) {
4438 for(i = 0; i < hLength; i++) {
4439 dx[i].ModSub(&Gn[i].x,&startP.x);
4440 }
4441 dx[i].ModSub(&Gn[i].x,&startP.x); // For the first point
4442 dx[i + 1].ModSub(&_2Gn.x,&startP.x);// For the next center point
4443 // Grouped ModInv
4444 grp->ModInv();
4445
4446 // We use the fact that P + i*G and P - i*G has the same deltax, so the same inverse
4447 // We compute key in the positive and negative way from the center of the group
4448 // center point
4449
4450 pts[CPU_GRP_SIZE / 2] = startP; //Center point
4451
4452 for(i = 0; i<hLength; i++) {
4453 pp = startP;
4454 pn = startP;
4455
4456 // P = startP + i*G
4457 dy.ModSub(&Gn[i].y,&pp.y);
4458
4459 _s.ModMulK1(&dy,&dx[i]); // s = (p2.y-p1.y)*inverse(p2.x-p1.x);
4460 _p.ModSquareK1(&_s); // _p = pow2(s)
4461

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