| 5327 | DWORD WINAPI thread_process_bsgs_both(LPVOID vargp) { |
| 5328 | #else |
| 5329 | void *thread_process_bsgs_both(void *vargp) { |
| 5330 | #endif |
| 5331 | FILE *filekey; |
| 5332 | struct tothread *tt; |
| 5333 | char xpoint_raw[32],*aux_c,*hextemp; |
| 5334 | Int base_key,keyfound; |
| 5335 | Point base_point,point_aux,point_found; |
| 5336 | uint32_t k,l,r,salir,thread_number,entrar,cycles; |
| 5337 | |
| 5338 | IntGroup *grp = new IntGroup(CPU_GRP_SIZE / 2 + 1); |
| 5339 | Point startP; |
| 5340 | |
| 5341 | int hLength = (CPU_GRP_SIZE / 2 - 1); |
| 5342 | |
| 5343 | Int dx[CPU_GRP_SIZE / 2 + 1]; |
| 5344 | Point pts[CPU_GRP_SIZE]; |
| 5345 | |
| 5346 | Int dy; |
| 5347 | Int dyn; |
| 5348 | Int _s; |
| 5349 | Int _p; |
| 5350 | Int km,intaux; |
| 5351 | Point pp; |
| 5352 | Point pn; |
| 5353 | grp->Set(dx); |
| 5354 | |
| 5355 | |
| 5356 | tt = (struct tothread *)vargp; |
| 5357 | thread_number = tt->nt; |
| 5358 | free(tt); |
| 5359 | |
| 5360 | cycles = bsgs_aux / 1024; |
| 5361 | if(bsgs_aux % 1024 != 0) { |
| 5362 | cycles++; |
| 5363 | } |
| 5364 | intaux.Set(&BSGS_M_double); |
| 5365 | intaux.Mult(CPU_GRP_SIZE/2); |
| 5366 | intaux.Add(&BSGS_M); |
| 5367 | |
| 5368 | entrar = 1; |
| 5369 | |
| 5370 | |
| 5371 | /* |
| 5372 | while BSGS_CURRENT is less than n_range_end |
| 5373 | */ |
| 5374 | do { |
| 5375 | |
| 5376 | r = rand() % 2; |
| 5377 | #if defined(_WIN64) && !defined(__CYGWIN__) |
| 5378 | WaitForSingleObject(bsgs_thread, INFINITE); |
| 5379 | #else |
| 5380 | pthread_mutex_lock(&bsgs_thread); |
| 5381 | #endif |
| 5382 | switch(r) { |
| 5383 | case 0: //TOP |
| 5384 | if(n_range_end.IsGreater(&BSGS_CURRENT)) { |
| 5385 | n_range_end.Sub(&BSGS_N_double); |
| 5386 | /* |
nothing calls this directly
no test coverage detected