Skip to content

Commit

Permalink
change murmurhash2 to xxhash. Added a second bloomfilter for bsgs, le…
Browse files Browse the repository at this point in the history
…ss RAM more speed
  • Loading branch information
albertobsd committed Mar 22, 2021
1 parent 519cbfd commit b8f6434
Show file tree
Hide file tree
Showing 13 changed files with 5,861 additions and 221 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ heapsort.c
insertionsorttest.c
introsort.c

*.txt
# Prerequisites
*.d

Expand Down
27 changes: 16 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,54 @@
#Version 0.1.20210320 K*BSGS
# Version 0.1.20210322
- Added xxhash for bloomfilter it hash better performance than murmurhash2. And it is 64 bits hash :)
- We reduce the number of items of the bPtable in ram using a second bloom filter, thanks @iceland2k14
- The ram saved space is around 80%, so we can use a bigger K value, around 4 or 5 times bigger than previous version

# Version 0.1.20210320 K*BSGS
- Solved little error with compress and uncompress new param -l. See https://github.com/albertobsd/keyhunt/issues/17
- funtion bsgs optimized to use a little less RAM (not related with Pfile)
- Again removed some compile warnings. See https://github.com/albertobsd/keyhunt/issues/16

#Version 0.1.20210311 K*BSGS
# Version 0.1.20210311 K*BSGS
- Added mode rmd160, this method works two times faster than Address method. This mode can search all the altcoins


#Version 0.1.20210311 K*BSGS
# Version 0.1.20210311 K*BSGS
- Solved some bug when the publickeys in the input file was invalid but the program keeps running with 0 publickeys
- Now publickeys can be compressed, not only uncompressed

#Version 0.1.20210306 K*BSGS
# Version 0.1.20210306 K*BSGS
- Added K factor for BSGS
- Added bPfile.c to generate a precalculated file
- Remove unused files about keccak and sha3
- Change Bloom filter limits and % of error from 0.001 to 0.00001 in bloomfilter.

#Version 0.1.20210112 BSGS
# Version 0.1.20210112 BSGS
- Added mode BSGS this work with a file with uncompressed keys
- Updated bloom filter to allow More items


#Version 0.1.20201228
# Version 0.1.20201228
- Change Quicksort to Introsort, this solve some edge cases of quicksort.
- Introsort is avaible to keyhunt and hexcharstoraw. worst case. O(N log N).
- Aling of some output text

#Version 0.1.20201223
# Version 0.1.20201223
- Added new tool hexcharstoraw to create a raw binary file for xpoint from a text-hexadecimal file
- Added option -w to work with raw binary file, this file contains xpoint in binary format fixed to 32 bytes

#Version 0.1.20201222
# Version 0.1.20201222
- Fixed some ugly bug in the searchbinary function thanks to Ujang
- Added to stdout the vanitykeys found with -v option

#Version 0.1.20201221
# Version 0.1.20201221
- Fixed search by xpoint.
- Added -e option to skip the sort process whe the file is already sorted.
- Fixed debugcount when upto N is less than debugcount.
- Changed "-R upto" to "-R" and added "-n upto" option.

#Version 0.1.20201218
# Version 0.1.20201218
- Minor bugs fixed.

#Version 0.1.20201217
# Version 0.1.20201217
- First Realease
- Thanks to all CryptoHunters to make this code possible
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ default:
gcc -O3 -c base58/base58.c -o base58.o
gcc -O3 -c rmd160/rmd160.c -o rmd160.o
gcc -O3 -c sha3/sha3.c -o sha3.o
gcc -O3 -c xxhash/xxhash.c -o xxhash.o
gcc -O3 -c keyhunt.c -o keyhunt.o -lm
gcc -o keyhunt keyhunt.o base58.o rmd160.o sha256.o bloom.o murmurhash2.o -lgmp -lm -lpthread
gcc -o keyhunt keyhunt.o base58.o rmd160.o sha256.o bloom.o murmurhash2.o xxhash.o -lgmp -lm -lpthread
gcc -O3 hexcharstoraw.c -o hexcharstoraw -lm
gcc -o bPfile bPfile.c -lgmp -lm
clean:
Expand Down
16 changes: 8 additions & 8 deletions bloom/bloom.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@

#include "bloom.h"
#include "murmurhash2.h"
#include "../xxhash/xxhash.h"

#define MAKESTRING(n) STRING(n)
#define STRING(n) #n
#define BLOOM_MAGIC "libbloom2"
#define BLOOM_VERSION_MAJOR 2
#define BLOOM_VERSION_MINOR 1

inline static int test_bit_set_bit(unsigned char * buf,
unsigned int bit, int set_bit)
inline static int test_bit_set_bit(unsigned char * buf, uint64_t bit, int set_bit)
{
unsigned int byte = bit >> 3;
unsigned char c = buf[byte]; // expensive memory access
Expand All @@ -56,9 +56,9 @@ static int bloom_check_add(struct bloom * bloom,
}

unsigned char hits = 0;
unsigned int a = murmurhash2(buffer, len, 0x9747b28c);
unsigned int b = murmurhash2(buffer, len, a);
unsigned int x;
uint64_t a = XXH64(buffer, len, 0x59f2815b16f81798);/*0x9747b28c); */
uint64_t b = XXH64(buffer, len, a);
uint64_t x;
unsigned char i;

for (i = 0; i < bloom->hashes; i++) {
Expand All @@ -80,13 +80,13 @@ static int bloom_check_add(struct bloom * bloom,


// DEPRECATED - Please migrate to bloom_init2.
int bloom_init(struct bloom * bloom, unsigned long long int entries, double error)
int bloom_init(struct bloom * bloom, unsigned long long int entries, long double error)
{
return bloom_init2(bloom, entries, error);
}


int bloom_init2(struct bloom * bloom, unsigned long long int entries, double error)
int bloom_init2(struct bloom * bloom, unsigned long long int entries, long double error)
{
memset(bloom, 0, sizeof(struct bloom));

Expand Down Expand Up @@ -145,7 +145,7 @@ void bloom_print(struct bloom * bloom)
if (!bloom->ready) { printf(" *** NOT READY ***\n"); }
printf(" ->version = %d.%d\n", bloom->major, bloom->minor);
printf(" ->entries = %llu\n", bloom->entries);
printf(" ->error = %f\n", bloom->error);
printf(" ->error = %lf\n", bloom->error);
printf(" ->bits = %llu\n", bloom->bits);
printf(" ->bits per elem = %f\n", bloom->bpe);
printf(" ->bytes = %llu", bloom->bytes);
Expand Down
8 changes: 4 additions & 4 deletions bloom/bloom.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct bloom
unsigned long long int bits;
unsigned long long int bytes;
unsigned char hashes;
double error;
long double error;

// Fields below are private to the implementation. These may go away or
// change incompatibly at any moment. Client code MUST NOT access or rely
Expand Down Expand Up @@ -68,15 +68,15 @@ struct bloom
* 1 - on failure
*
*/
int bloom_init2(struct bloom * bloom, unsigned long long int entries, double error);
int bloom_init2(struct bloom * bloom, unsigned long long int entries, long double error);


/**
* DEPRECATED.
* Kept for compatibility with libbloom v.1. To be removed in v3.0.
*
*/
int bloom_init(struct bloom * bloom, unsigned long long int entries, double error);
int bloom_init(struct bloom * bloom, unsigned long long int entries, long double error);


/** ***************************************************************************
Expand Down Expand Up @@ -207,4 +207,4 @@ const char * bloom_version();
}
#endif

#endif
#endif
Loading

0 comments on commit b8f6434

Please sign in to comment.