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

Function bsgs_secondcheck

bsgsd.cpp:1831–1865  ·  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

1829 This funtion is made with the especific purpouse to USE a smaller bPtable in RAM.
1830*/
1831int bsgs_secondcheck(Int *start_range,uint32_t a,Int *privatekey) {
1832 int i = 0,found = 0,r = 0;
1833 Int base_key;
1834 Point base_point,point_aux;
1835 Point BSGS_Q, BSGS_S,BSGS_Q_AMP;
1836 char xpoint_raw[32];
1837
1838 base_key.Set(&BSGS_M_double);
1839 base_key.Mult((uint64_t) a);
1840 base_key.Add(start_range);
1841
1842 base_point = secp->ComputePublicKey(&base_key);
1843 point_aux = secp->Negation(base_point);
1844 /*
1845 BSGS_S = Q - base_key
1846 Q is the target Key
1847 base_key is the Start range + a*BSGS_M
1848 */
1849
1850 BSGS_S = secp->AddDirect(OriginalPointsBSGS,point_aux);
1851 BSGS_Q.Set(BSGS_S);
1852 do {
1853 BSGS_Q_AMP = secp->AddDirect(BSGS_Q,BSGS_AMP2[i]);
1854 BSGS_S.Set(BSGS_Q_AMP);
1855 BSGS_S.x.Get32Bytes((unsigned char *) xpoint_raw);
1856
1857 r = bloom_check(&bloom_bPx2nd[(uint8_t) xpoint_raw[0]],xpoint_raw,32);
1858
1859 if(r) {
1860 found = bsgs_thirdcheck(&base_key,i,privatekey);
1861 }
1862 i++;
1863 }while(i < 32 && !found);
1864 return found;
1865}
1866
1867int bsgs_thirdcheck(Int *start_range,uint32_t a,Int *privatekey) {
1868 uint64_t j = 0;

Callers 1

thread_process_bsgsFunction · 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