| 5801 | } |
| 5802 | |
| 5803 | void 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 | |
| 5837 | int addvanity(char *target) { |
no test coverage detected