|
|
@ -374,4 +374,21 @@ int32_t LP_passphrase_init(char *passphrase,char *gui) |
|
|
|
return(0); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void LP_privkey_tests() |
|
|
|
{ |
|
|
|
char wifstr[64],str[65],str2[65]; bits256 privkey,checkkey; int32_t i; uint8_t tmptype; |
|
|
|
for (i=0; i<10000000; i++) |
|
|
|
{ |
|
|
|
privkey = rand256(0); |
|
|
|
bitcoin_priv2wif(0,wifstr,privkey,0); |
|
|
|
bitcoin_wif2priv(0,&tmptype,&checkkey,wifstr); |
|
|
|
if ( bits256_cmp(privkey,checkkey) != 0 ) |
|
|
|
{ |
|
|
|
printf("i.%d: %s != %s\n",i,bits256_str(str,privkey),bits256_str(str2,checkkey)); |
|
|
|
exit(-1); |
|
|
|
} |
|
|
|
if ( (i % 1000000) == 0 ) |
|
|
|
fprintf(stderr,"%.1f%% ",100.*(double)i/10000000); |
|
|
|
} |
|
|
|
printf("%d privkeys checked\n",i); |
|
|
|
} |
|
|
|