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

Function writevanitykey

keyhunt.cpp:5803–5834  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5801}
5802
5803void writevanitykey(bool compressed,Int *key) {
5804 Point publickey;
5805 FILE *keys;
5806 char *hextemp,*hexrmd,public_key_hex[131],address[50],rmdhash[20];
5807 hextemp = key->GetBase16();
5808 publickey = secp->ComputePublicKey(key);
5809 secp->GetPublicKeyHex(compressed,publickey,public_key_hex);
5810
5811 secp->GetHash160(P2PKH,compressed,publickey,(uint8_t*)rmdhash);
5812 hexrmd = tohex(rmdhash,20);
5813 rmd160toaddress_dst(rmdhash,address);
5814
5815#if defined(_WIN64) && !defined(__CYGWIN__)
5816 WaitForSingleObject(write_keys, INFINITE);
5817#else
5818 pthread_mutex_lock(&write_keys);
5819#endif
5820 keys = fopen("VANITYKEYFOUND.txt","a+");
5821 if(keys != NULL) {
5822 fprintf(keys,"Vanity Private Key: %s\npubkey: %s\nAddress %s\nrmd160 %s\n",hextemp,public_key_hex,address,hexrmd);
5823 fclose(keys);
5824 }
5825 printf("\nVanity Private Key: %s\npubkey: %s\nAddress %s\nrmd160 %s\n",hextemp,public_key_hex,address,hexrmd);
5826
5827#if defined(_WIN64) && !defined(__CYGWIN__)
5828 ReleaseMutex(write_keys);
5829#else
5830 pthread_mutex_unlock(&write_keys);
5831#endif
5832 free(hextemp);
5833 free(hexrmd);
5834}
5835
5836
5837int addvanity(char *target) {

Callers 1

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