Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleaner log messages. #302

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 21 additions & 11 deletions keyhunt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2195,15 +2195,25 @@ int main(int argc, char **argv) {
pretotal.Div(&seconds);
str_seconds = seconds.GetBase10();
str_pretotal = pretotal.GetBase10();
str_total = total.GetBase10();


str_total = total.GetBase10('_');
char str_range_ratio[2048];
if (!total.IsZero()) {
Int range_ratio;
range_ratio.Sub(&n_range_end, &n_range_start);
range_ratio.Div(&total, 0);
sprintf(str_range_ratio, ", 1:%s ", range_ratio.GetBase10('_'));
}
else {
str_range_ratio[0] = 0;
}


if(pretotal.IsLower(&int_limits[0])) {
if(FLAGMATRIX) {
sprintf(buffer,"[+] Total %s keys in %s seconds: %s keys/s\n",str_total,str_seconds,str_pretotal);
sprintf(buffer,"[+] Total %s keys in %s seconds: %s keys/s%s\n",str_total,str_seconds,str_pretotal,str_range_ratio);
}
else {
sprintf(buffer,"\r[+] Total %s keys in %s seconds: %s keys/s\r",str_total,str_seconds,str_pretotal);
sprintf(buffer,"\r[+] Total %s keys in %s seconds: %s keys/s%s\r",str_total,str_seconds,str_pretotal,str_range_ratio);
}
}
else {
Expand All @@ -2222,14 +2232,14 @@ int main(int argc, char **argv) {
div_pretotal.Div(&int_limits[salir ? i : i-1]);
str_divpretotal = div_pretotal.GetBase10();
if(FLAGMATRIX) {
sprintf(buffer,"[+] Total %s keys in %s seconds: ~%s %s (%s keys/s)\n",str_total,str_seconds,str_divpretotal,str_limits_prefixs[salir ? i : i-1],str_pretotal);
sprintf(buffer,"[+] Total %s keys in %s seconds: ~%s %s (%s keys/s)%s\n",str_total,str_seconds,str_divpretotal,str_limits_prefixs[salir ? i : i-1],str_pretotal,str_range_ratio);
}
else {
if(THREADOUTPUT == 1) {
sprintf(buffer,"\r[+] Total %s keys in %s seconds: ~%s %s (%s keys/s)\r",str_total,str_seconds,str_divpretotal,str_limits_prefixs[salir ? i : i-1],str_pretotal);
sprintf(buffer,"\r[+] Total %s keys in %s seconds: ~%s %s (%s keys/s)%s\r",str_total,str_seconds,str_divpretotal,str_limits_prefixs[salir ? i : i-1],str_pretotal,str_range_ratio);
}
else {
sprintf(buffer,"\r[+] Total %s keys in %s seconds: ~%s %s (%s keys/s)\r",str_total,str_seconds,str_divpretotal,str_limits_prefixs[salir ? i : i-1],str_pretotal);
sprintf(buffer,"\r[+] Total %s keys in %s seconds: ~%s %s (%s keys/s)%s\r",str_total,str_seconds,str_divpretotal,str_limits_prefixs[salir ? i : i-1],str_pretotal,str_range_ratio);
}
}
free(str_divpretotal);
Expand Down Expand Up @@ -5819,11 +5829,11 @@ void writevanitykey(bool compressed,Int *key) {
#endif
keys = fopen("VANITYKEYFOUND.txt","a+");
if(keys != NULL) {
fprintf(keys,"Vanity Private Key: %s\npubkey: %s\nAddress %s\nrmd160 %s\n",hextemp,public_key_hex,address,hexrmd);
fprintf(keys,"Vanity Private Key: %s\npubkey: %s\nAddress %s\nrmd160 %s\n\n",hextemp,public_key_hex,address,hexrmd);
fclose(keys);
}
printf("\nVanity Private Key: %s\npubkey: %s\nAddress %s\nrmd160 %s\n",hextemp,public_key_hex,address,hexrmd);
printf("\nVanity Private Key: %s\npubkey: %s\nAddress %s\nrmd160 %s\n\n",hextemp,public_key_hex,address,hexrmd);

#if defined(_WIN64) && !defined(__CYGWIN__)
ReleaseMutex(write_keys);
#else
Expand Down
11 changes: 7 additions & 4 deletions secp256k1/Int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -942,8 +942,8 @@ void Int::SetBase16(const char *value) {

// ------------------------------------------------

char* Int::GetBase10() {
return GetBaseN(10,"0123456789");
char* Int::GetBase10(char thousand_separator) {
return GetBaseN(10,"0123456789",thousand_separator);
}

// ------------------------------------------------
Expand Down Expand Up @@ -1014,7 +1014,7 @@ void Int::SetBaseN(int n,const char *charset,const char *value) {

// ------------------------------------------------

char* Int::GetBaseN(int n,const char *charset) {
char* Int::GetBaseN(int n,const char *charset,char thousand_separator) {
char *ret = (char*) calloc(1,1024);

Int N(this);
Expand Down Expand Up @@ -1044,8 +1044,11 @@ char* Int::GetBaseN(int n,const char *charset) {
if (isNegative)
ret[offset++] = '-';

for (int i = 0; i < digitslen; i++)
for (int i = 0; i < digitslen; i++) {
if (thousand_separator && (i > 0) && (i % 3 == digitslen % 3))
ret[offset++] = thousand_separator;
ret[offset++] = charset[digits[digitslen - 1 - i]];
}

if (offset == 0)
ret[offset] = '0';
Expand Down
4 changes: 2 additions & 2 deletions secp256k1/Int.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ class Int {
void Get32Bytes(unsigned char *buff);

char* GetBase2();
char* GetBase10();
char* GetBase10(char thousand_separator = 0);
char* GetBase16();
char* GetBaseN(int n,const char *charset);
char* GetBaseN(int n,const char *charset,char thousand_separator = 0);
char* GetBlockStr();
char* GetC64Str(int nbDigit);

Expand Down