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

Function writekey

keyhunt.cpp:5989–6021  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5987}
5988
5989void writekey(bool compressed,Int *key) {
5990 Point publickey;
5991 FILE *keys;
5992 char *hextemp,*hexrmd,public_key_hex[132],address[50],rmdhash[20];
5993 memset(address,0,50);
5994 memset(public_key_hex,0,132);
5995 hextemp = key->GetBase16();
5996 publickey = secp->ComputePublicKey(key);
5997 secp->GetPublicKeyHex(compressed,publickey,public_key_hex);
5998 secp->GetHash160(P2PKH,compressed,publickey,(uint8_t*)rmdhash);
5999 hexrmd = tohex(rmdhash,20);
6000 rmd160toaddress_dst(rmdhash,address);
6001
6002#if defined(_WIN64) && !defined(__CYGWIN__)
6003 WaitForSingleObject(write_keys, INFINITE);
6004#else
6005 pthread_mutex_lock(&write_keys);
6006#endif
6007 keys = fopen("KEYFOUNDKEYFOUND.txt","a+");
6008 if(keys != NULL) {
6009 fprintf(keys,"Private Key: %s\npubkey: %s\nAddress %s\nrmd160 %s\n",hextemp,public_key_hex,address,hexrmd);
6010 fclose(keys);
6011 }
6012 printf("\nHit! Private Key: %s\npubkey: %s\nAddress %s\nrmd160 %s\n",hextemp,public_key_hex,address,hexrmd);
6013
6014#if defined(_WIN64) && !defined(__CYGWIN__)
6015 ReleaseMutex(write_keys);
6016#else
6017 pthread_mutex_unlock(&write_keys);
6018#endif
6019 free(hextemp);
6020 free(hexrmd);
6021}
6022
6023void writekeyeth(Int *key) {
6024 Point publickey;

Callers 1

thread_processFunction · 0.70

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