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

Function bsgs_secondcheck

keyhunt.cpp:4271–4304  ·  view source on GitHub ↗

The bsgs_secondcheck function is made to perform a second BSGS search in a Range of less size. This funtion is made with the especific purpouse to USE a smaller bPtable in RAM. */

Source from the content-addressed store, hash-verified

4269 This funtion is made with the especific purpouse to USE a smaller bPtable in RAM.
4270*/
4271int bsgs_secondcheck(Int *start_range,uint32_t a,uint32_t k_index,Int *privatekey) {
4272 int i = 0,found = 0,r = 0;
4273 Int base_key;
4274 Point base_point,point_aux;
4275 Point BSGS_Q, BSGS_S,BSGS_Q_AMP;
4276 char xpoint_raw[32];
4277
4278
4279 base_key.Set(&BSGS_M_double);
4280 base_key.Mult((uint64_t) a);
4281 base_key.Add(start_range);
4282
4283 base_point = secp->ComputePublicKey(&base_key);
4284 point_aux = secp->Negation(base_point);
4285
4286 /*
4287 BSGS_S = Q - base_key
4288 Q is the target Key
4289 base_key is the Start range + a*BSGS_M
4290 */
4291 BSGS_S = secp->AddDirect(OriginalPointsBSGS[k_index],point_aux);
4292 BSGS_Q.Set(BSGS_S);
4293 do {
4294 BSGS_Q_AMP = secp->AddDirect(BSGS_Q,BSGS_AMP2[i]);
4295 BSGS_S.Set(BSGS_Q_AMP);
4296 BSGS_S.x.Get32Bytes((unsigned char *) xpoint_raw);
4297 r = bloom_check(&bloom_bPx2nd[(uint8_t) xpoint_raw[0]],xpoint_raw,32);
4298 if(r) {
4299 found = bsgs_thirdcheck(&base_key,i,k_index,privatekey);
4300 }
4301 i++;
4302 }while(i < 32 && !found);
4303 return found;
4304}
4305
4306int bsgs_thirdcheck(Int *start_range,uint32_t a,uint32_t k_index,Int *privatekey) {
4307 uint64_t j = 0;

Callers 5

thread_process_bsgsFunction · 0.70
thread_process_bsgs_bothFunction · 0.70

Calls 9

bloom_checkFunction · 0.85
bsgs_thirdcheckFunction · 0.70
SetMethod · 0.45
MultMethod · 0.45
AddMethod · 0.45
ComputePublicKeyMethod · 0.45
NegationMethod · 0.45
AddDirectMethod · 0.45
Get32BytesMethod · 0.45

Tested by

no test coverage detected