| 5987 | } |
| 5988 | |
| 5989 | void 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 | |
| 6023 | void writekeyeth(Int *key) { |
| 6024 | Point publickey; |
no test coverage detected