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

Function writekey

bsgsd.cpp:2302–2326  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2300}
2301
2302void writekey(bool compressed,Int *key) {
2303 Point publickey;
2304 FILE *keys;
2305 char *hextemp,*hexrmd,public_key_hex[132],address[50],rmdhash[20];
2306 memset(address,0,50);
2307 memset(public_key_hex,0,132);
2308 hextemp = key->GetBase16();
2309 publickey = secp->ComputePublicKey(key);
2310 secp->GetPublicKeyHex(compressed,publickey,public_key_hex);
2311 secp->GetHash160(P2PKH,compressed,publickey,(uint8_t*)rmdhash);
2312 hexrmd = tohex(rmdhash,20);
2313 rmd160toaddress_dst(rmdhash,address);
2314
2315 pthread_mutex_lock(&write_keys);
2316 keys = fopen("KEYFOUNDKEYFOUND.txt","a+");
2317 if(keys != NULL) {
2318 fprintf(keys,"Private Key: %s\npubkey: %s\nAddress %s\nrmd160 %s\n",hextemp,public_key_hex,address,hexrmd);
2319 fclose(keys);
2320 }
2321 printf("\nHit! Private Key: %s\npubkey: %s\nAddress %s\nrmd160 %s\n",hextemp,public_key_hex,address,hexrmd);
2322
2323 pthread_mutex_unlock(&write_keys);
2324 free(hextemp);
2325 free(hexrmd);
2326}
2327
2328
2329void init_generator() {

Callers

nothing calls this directly

Calls 6

tohexFunction · 0.85
rmd160toaddress_dstFunction · 0.70
GetBase16Method · 0.45
ComputePublicKeyMethod · 0.45
GetPublicKeyHexMethod · 0.45
GetHash160Method · 0.45

Tested by

no test coverage detected