| 2300 | } |
| 2301 | |
| 2302 | void 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 | |
| 2329 | void init_generator() { |
nothing calls this directly
no test coverage detected