custombloom and file with comments for xpoint mode

This commit is contained in:
AlbertoBSD 2021-03-30 12:15:42 +02:00
parent f994d9b40a
commit 5b6c2b9266
6 changed files with 543 additions and 26 deletions

View File

@ -1,3 +1,7 @@
# Version 0.1.20210330
- xpoint mode now accept files with comments, useful for susbtracted keys with index
- custom bloomfilter, this bloom avoid hashing process
# Version 0.1.20210328
- Added a progress counter (this solve bug https://github.com/albertobsd/keyhunt/issues/18 )
- Added multithread for precalculating bP items or reading then from file

View File

@ -1,12 +1,13 @@
default:
gcc -O3 -c bloom/bloom.c -o bloom.o
gcc -O3 -c custombloom/bloom.c -o custombloom.o
gcc -O3 -c sha256/sha256.c -o sha256.o
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 xxhash.o -lgmp -lm -lpthread
gcc -o keyhunt keyhunt.o base58.o rmd160.o sha256.o custombloom.o bloom.o xxhash.o -lgmp -lm -lpthread
gcc -O3 hexcharstoraw.c -o hexcharstoraw -lm
gcc -o bPfile bPfile.c -lgmp -lm
clean:

26
custombloom/LICENSE Normal file
View File

@ -0,0 +1,26 @@
Copyright (c) 2012,2015,2016,2017 Jyri J. Virkki
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

272
custombloom/bloom.c Normal file
View File

@ -0,0 +1,272 @@
/*
* Copyright (c) 2012-2019, Jyri J. Virkki
* All rights reserved.
*
* This file is under BSD license. See LICENSE file.
*/
/*
* Refer to custombloom.h for documentation on the public interfaces.
*/
#include <assert.h>
#include <fcntl.h>
#include <math.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <inttypes.h>
#include <sys/types.h>
#include <unistd.h>
#include "bloom.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 custombloom_test_bit_set_bit(unsigned char * buf, uint64_t bit, int set_bit)
{
uint64_t byte = bit >> 3;
uint8_t c = buf[byte]; // expensive memory access
uint8_t mask = 1 << (bit % 8);
if (c & mask) {
return 1;
} else {
if (set_bit) {
buf[byte] = c | mask;
}
return 0;
}
}
static int custombloom_check_add(struct custombloom * bloom, const void * buffer, int len, int add)
{
if (bloom->ready == 0) {
printf("bloom at %p not initialized!\n", (void *)bloom);
return -1;
}
uint8_t hits = 0;
uint64_t *data = (uint64_t *)buffer;
uint64_t x;
uint8_t i;
for (i = 0; i < bloom->hashes; i++) {
x = (data[0] + data[1] *i) % bloom->bits;
if (custombloom_test_bit_set_bit(bloom->bf, x, add)) {
hits++;
} else if (!add) {
// Don't care about the presence of all the bits. Just our own.
return 0;
}
}
if (hits == bloom->hashes) {
return 1; // 1 == element already in (or collision)
}
return 0;
}
// DEPRECATED - Please migrate to bloom_init2.
int custombloom_init(struct custombloom * bloom, uint64_t entries, long double error)
{
return custombloom_init2(bloom, entries, error);
}
int custombloom_init2(struct custombloom * bloom, uint64_t entries, long double error)
{
memset(bloom, 0, sizeof(struct custombloom));
if (entries < 1000 || error <= 0 || error >= 1) {
return 1;
}
bloom->entries = entries;
bloom->error = error;
long double num = -log(bloom->error);
long double denom = 0.480453013918201; // ln(2)^2
bloom->bpe = (num / denom);
long double dentries = (long double)entries;
long double allbits = dentries * bloom->bpe;
bloom->bits = (uint64_t)allbits;
bloom->bytes = (uint64_t) bloom->bits / 8;
if (bloom->bits % 8) {
bloom->bytes +=1;
}
bloom->hashes = (uint8_t)ceil(0.693147180559945 * bloom->bpe); // ln(2)
bloom->bf = (uint8_t *)calloc(bloom->bytes, sizeof(uint8_t));
if (bloom->bf == NULL) { // LCOV_EXCL_START
return 1;
} // LCOV_EXCL_STOP
bloom->ready = 1;
bloom->major = BLOOM_VERSION_MAJOR;
bloom->minor = BLOOM_VERSION_MINOR;
return 0;
}
int custombloom_check(struct custombloom * bloom, const void * buffer, int len)
{
return custombloom_check_add(bloom, buffer, len, 0);
}
int custombloom_add(struct custombloom * bloom, const void * buffer, int len)
{
return custombloom_check_add(bloom, buffer, len, 1);
}
void custombloom_print(struct custombloom * bloom)
{
printf("bloom at %p\n", (void *)bloom);
if (!bloom->ready) { printf(" *** NOT READY ***\n"); }
printf(" ->version = %d.%d\n", bloom->major, bloom->minor);
printf(" ->entries = %"PRIu64"\n", bloom->entries);
printf(" ->error = %Lf\n", bloom->error);
printf(" ->bits = %"PRIu64"\n", bloom->bits);
printf(" ->bits per elem = %f\n", bloom->bpe);
printf(" ->bytes = %"PRIu64"\n", bloom->bytes);
unsigned int KB = bloom->bytes / 1024;
unsigned int MB = KB / 1024;
printf(" (%u KB, %u MB)\n", KB, MB);
printf(" ->hash functions = %d\n", bloom->hashes);
}
void custombloom_free(struct custombloom * bloom)
{
if (bloom->ready) {
free(bloom->bf);
}
bloom->ready = 0;
}
int custombloom_reset(struct custombloom * bloom)
{
if (!bloom->ready) return 1;
memset(bloom->bf, 0, bloom->bytes);
return 0;
}
int custombloom_save(struct custombloom * bloom, char * filename)
{
if (filename == NULL || filename[0] == 0) {
return 1;
}
int fd = open(filename, O_WRONLY | O_CREAT, 0644);
if (fd < 0) {
return 1;
}
ssize_t out = write(fd, BLOOM_MAGIC, strlen(BLOOM_MAGIC));
if (out != strlen(BLOOM_MAGIC)) { goto save_error; } // LCOV_EXCL_LINE
uint16_t size = sizeof(struct custombloom);
out = write(fd, &size, sizeof(uint16_t));
if (out != sizeof(uint16_t)) { goto save_error; } // LCOV_EXCL_LINE
out = write(fd, bloom, sizeof(struct custombloom));
if (out != sizeof(struct custombloom)) { goto save_error; } // LCOV_EXCL_LINE
out = write(fd, bloom->bf, bloom->bytes);
if (out != bloom->bytes) { goto save_error; } // LCOV_EXCL_LINE
close(fd);
return 0;
// LCOV_EXCL_START
save_error:
close(fd);
return 1;
// LCOV_EXCL_STOP
}
int custombloom_load(struct custombloom * bloom, char * filename)
{
int rv = 0;
if (filename == NULL || filename[0] == 0) { return 1; }
if (bloom == NULL) { return 2; }
memset(bloom, 0, sizeof(struct custombloom));
int fd = open(filename, O_RDONLY);
if (fd < 0) { return 3; }
char line[30];
memset(line, 0, 30);
ssize_t in = read(fd, line, strlen(BLOOM_MAGIC));
if (in != strlen(BLOOM_MAGIC)) {
rv = 4;
goto load_error;
}
if (strncmp(line, BLOOM_MAGIC, strlen(BLOOM_MAGIC))) {
rv = 5;
goto load_error;
}
uint16_t size;
in = read(fd, &size, sizeof(uint16_t));
if (in != sizeof(uint16_t)) {
rv = 6;
goto load_error;
}
if (size != sizeof(struct custombloom)) {
rv = 7;
goto load_error;
}
in = read(fd, bloom, sizeof(struct custombloom));
if (in != sizeof(struct custombloom)) {
rv = 8;
goto load_error;
}
bloom->bf = NULL;
if (bloom->major != BLOOM_VERSION_MAJOR) {
rv = 9;
goto load_error;
}
bloom->bf = (unsigned char *)malloc(bloom->bytes);
if (bloom->bf == NULL) { rv = 10; goto load_error; } // LCOV_EXCL_LINE
in = read(fd, bloom->bf, bloom->bytes);
if (in != bloom->bytes) {
rv = 11;
free(bloom->bf);
bloom->bf = NULL;
goto load_error;
}
close(fd);
return rv;
load_error:
close(fd);
bloom->ready = 0;
return rv;
}
const char * custombloom_version()
{
return MAKESTRING(BLOOM_VERSION);
}

210
custombloom/bloom.h Normal file
View File

@ -0,0 +1,210 @@
/*
* Copyright (c) 2012-2019, Jyri J. Virkki
* All rights reserved.
*
* This file is under BSD license. See LICENSE file.
*/
#ifndef _CUSTOMBLOOM_H
#define _CUSTOMBLOOM_H
#ifdef __cplusplus
extern "C" {
#endif
/** ***************************************************************************
* Structure to keep track of one bloom filter. Caller needs to
* allocate this and pass it to the functions below. First call for
* every struct must be to bloom_init().
*
*/
struct custombloom
{
// These fields are part of the public interface of this structure.
// Client code may read these values if desired. Client code MUST NOT
// modify any of these.
uint64_t entries;
uint64_t bits;
uint64_t bytes;
uint8_t hashes;
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
// on these.
uint8_t ready;
uint8_t major;
uint8_t minor;
double bpe;
uint8_t *bf;
};
/** ***************************************************************************
* Initialize the bloom filter for use.
*
* The filter is initialized with a bit field and number of hash functions
* according to the computations from the wikipedia entry:
* http://en.wikipedia.org/wiki/Bloom_filter
*
* Optimal number of bits is:
* bits = (entries * ln(error)) / ln(2)^2
*
* Optimal number of hash functions is:
* hashes = bpe * ln(2)
*
* Parameters:
* -----------
* bloom - Pointer to an allocated struct custombloom (see above).
* entries - The expected number of entries which will be inserted.
* Must be at least 1000 (in practice, likely much larger).
* error - Probability of collision (as long as entries are not
* exceeded).
*
* Return:
* -------
* 0 - on success
* 1 - on failure
*
*/
int custombloom_init2(struct custombloom * bloom, uint64_t entries, long double error);
/**
* DEPRECATED.
* Kept for compatibility with libbloom v.1. To be removed in v3.0.
*
*/
int bcustombloom_init(struct custombloom * bloom, uint64_t entries, long double error);
/** ***************************************************************************
* Check if the given element is in the bloom filter. Remember this may
* return false positive if a collision occurred.
*
* Parameters:
* -----------
* bloom - Pointer to an allocated struct custombloom (see above).
* buffer - Pointer to buffer containing element to check.
* len - Size of 'buffer'.
*
* Return:
* -------
* 0 - element is not present
* 1 - element is present (or false positive due to collision)
* -1 - bloom not initialized
*
*/
int custombloom_check(struct custombloom * bloom, const void * buffer, int len);
/** ***************************************************************************
* Add the given element to the bloom filter.
* The return code indicates if the element (or a collision) was already in,
* so for the common check+add use case, no need to call check separately.
*
* Parameters:
* -----------
* bloom - Pointer to an allocated struct custombloom (see above).
* buffer - Pointer to buffer containing element to add.
* len - Size of 'buffer'.
*
* Return:
* -------
* 0 - element was not present and was added
* 1 - element (or a collision) had already been added previously
* -1 - bloom not initialized
*
*/
int custombloom_add(struct custombloom * bloom, const void * buffer, int len);
/** ***************************************************************************
* Print (to stdout) info about this bloom filter. Debugging aid.
*
*/
void custombloom_print(struct custombloom * bloom);
/** ***************************************************************************
* Deallocate internal storage.
*
* Upon return, the bloom struct is no longer usable. You may call bloom_init
* again on the same struct to reinitialize it again.
*
* Parameters:
* -----------
* bloom - Pointer to an allocated struct custombloom (see above).
*
* Return: none
*
*/
void custombloom_free(struct custombloom * bloom);
/** ***************************************************************************
* Erase internal storage.
*
* Erases all elements. Upon return, the bloom struct returns to its initial
* (initialized) state.
*
* Parameters:
* -----------
* bloom - Pointer to an allocated struct custombloom (see above).
*
* Return:
* 0 - on success
* 1 - on failure
*
*/
int custombloom_reset(struct custombloom * bloom);
/** ***************************************************************************
* Save a bloom filter to a file.
*
* Parameters:
* -----------
* bloom - Pointer to an allocated struct custombloom (see above).
* filename - Create (or overwrite) bloom data to this file.
*
* Return:
* 0 - on success
* 1 - on failure
*
*/
int custombloom_save(struct custombloom * bloom, char * filename);
/** ***************************************************************************
* Load a bloom filter from a file.
*
* This functions loads a file previously saved with bloom_save().
*
* Parameters:
* -----------
* bloom - Pointer to an allocated struct custombloom (see above).
* filename - Load bloom filter data from this file.
*
* Return:
* 0 - on success
* > 0 - on failure
*
*/
int custombloom_load(struct custombloom * bloom, char * filename);
/** ***************************************************************************
* Returns version string compiled into library.
*
* Return: version string
*
*/
const char * custombloom_version();
#ifdef __cplusplus
}
#endif
#endif

View File

@ -17,6 +17,7 @@ email: alberto.bsd@gmail.com
#include "rmd160/rmd160.h"
#include "sha256/sha256.h"
#include "bloom/bloom.h"
#include "custombloom/bloom.h"
#include "sha3/sha3.h"
#include "util.h"
@ -63,7 +64,7 @@ struct bPload {
};
const char *version = "0.1.20210328";
const char *version = "0.1.20210330";
const char *EC_constant_N = "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141";
const char *EC_constant_P = "fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f";
const char *EC_constant_Gx = "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798";
@ -173,10 +174,9 @@ uint64_t BSGS_BUFFERREGISTERLENGTH = 36;
int *bsgs_found;
struct Point *OriginalPointsBSGS;
struct bsgs_xvalue *bPtable;
struct bloom bloom_bP[256];
struct custombloom bloom_bP[256];
struct custombloom bloom_bPx2nd; //Second Bloom filter check
uint64_t bloom_bP_totalbytes = 0;
struct bloom bloom_bPx;
struct bloom bloom_bPx2nd; //Second Bloom filter check
char *precalculated_p_filename;
uint64_t bsgs_m;
uint64_t bsgs_m2;
@ -209,7 +209,7 @@ int main(int argc, char **argv) {
char temporal[65];
char rawvalue[32];
struct tothread *tt; //tothread
Tokenizer t,tokenizerbsgs; //tokenizer
Tokenizer t,tokenizerbsgs,tokenizer_xpoint; //tokenizer
char *filename,*precalculated_mp_filename;
FILE *fd;
char *hextemp,*aux,*aux2,*pointx_str,*pointy_str;
@ -685,9 +685,10 @@ int main(int argc, char **argv) {
memset(DATABUFFER + (i*MAXLENGTHADDRESS),0,MAXLENGTHADDRESS);
if(hextemp == aux) {
trim(aux," \t\n\r");
lenaux = strlen(aux);
if(isValidHex(aux)) {
stringtokenizer(aux,&tokenizer_xpoint);
hextemp = nextToken(&tokenizer_xpoint);
lenaux = strlen(hextemp);
if(isValidHex(hextemp)) {
switch(lenaux) {
case 64: /*X value*/
if(hexs2bin(aux,(unsigned char*)(DATABUFFER + (uint64_t)(i*MAXLENGTHADDRESS)))) {
@ -737,11 +738,13 @@ int main(int argc, char **argv) {
else {
fprintf(stderr,"[E] Ignoring invalid hexvalue %s\n",aux);
}
freetokenizer(&tokenizer_xpoint);
}
else {
fprintf(stderr,"[E] Omiting line : %s\n",aux);
N--;
}
i++;
}
}
@ -1031,35 +1034,35 @@ int main(int argc, char **argv) {
for(i=0; i< 256; i++) {
if(((int)(bsgs_m/256)) > 1000) {
if(bloom_init2(&bloom_bP[i],(int)(bsgs_m/256),0.000001) == 1){
if(custombloom_init2(&bloom_bP[i],(int)(bsgs_m/256),0.000001) == 1){
fprintf(stderr,"[E] error bloom_init [%"PRIu64"]\n",i);
exit(0);
}
}
else {
if(bloom_init2(&bloom_bP[i],1000,0.000001) == 1){
if(custombloom_init2(&bloom_bP[i],1000,0.000001) == 1){
fprintf(stderr,"[E] error bloom_init for 1000 elements [%"PRIu64"]\n",i);
exit(0);
}
}
bloom_bP_totalbytes += bloom_bP[i].bytes;
if(FLAGDEBUG) bloom_print(&bloom_bP[i]);
if(FLAGDEBUG) custombloom_print(&bloom_bP[i]);
}
printf("[+] Init 1st bloom filter for %lu elements : %.2f MB\n",bsgs_m,(float)((uint64_t)bloom_bP_totalbytes/(uint64_t)1048576));
if(bsgs_m2 > 1000) {
if(bloom_init2(&bloom_bPx2nd,bsgs_m2,0.000001) == 1){
if(custombloom_init2(&bloom_bPx2nd,bsgs_m2,0.000001) == 1){
fprintf(stderr,"[E] error bloom_init for %lu elements\n",bsgs_m2);
exit(0);
}
}
else {
if(bloom_init2(&bloom_bPx2nd,1000,0.000001) == 1){
if(custombloom_init2(&bloom_bPx2nd,1000,0.000001) == 1){
fprintf(stderr,"[E] error bloom_init for 1000 elements\n");
exit(0);
}
}
if(FLAGDEBUG) bloom_print(&bloom_bPx2nd);
if(FLAGDEBUG) custombloom_print(&bloom_bPx2nd);
printf("[+] Init 2nd bloom filter for %lu elements : %.2f MB\n",bsgs_m2,(double)((double)bloom_bPx2nd.bytes/(double)1048576));
//bloom_print(&bloom_bPx2nd);
@ -1197,8 +1200,9 @@ int main(int argc, char **argv) {
for(i = 0; i < NTHREADS; i++) {
total_precalculated+=temp[i].counter;
}
printf("\r[+] processing %lu/%lu bP points : %i %%",total_precalculated,bsgs_m,(int) (((double)total_precalculated/(double)bsgs_m)*100));
printf("\r[+] processing %lu/%lu bP points : %i%%",total_precalculated,bsgs_m,(int) (((double)total_precalculated/(double)bsgs_m)*100));
} while(total_precalculated < bsgs_m);
for(i = 0; i < NTHREADS; i++) {
pthread_join(tid[i], NULL);
}
@ -2080,7 +2084,7 @@ int bsgs_searchbinary(struct bsgs_xvalue *buffer,char *data,int64_t _N,uint64_t
half = _N;
while(!r && half >= 1) {
half = (max - min)/2;
rcmp = memcmp(data,buffer[current+half].value,BSGS_XVALUE_RAM);
rcmp = memcmp(data+16,buffer[current+half].value,BSGS_XVALUE_RAM);
if(rcmp == 0) {
*r_value = buffer[current+half].index;
r = 1;
@ -2182,7 +2186,7 @@ void *thread_process_bsgs(void *vargp) {
//printf("Looking X : %s\n",xpoint_str);
/* Lookup for the xpoint_raw into the bloom filter*/
r = bloom_check(&bloom_bP[((unsigned char)xpoint_raw[0])],xpoint_raw,32);
r = custombloom_check(&bloom_bP[((unsigned char)xpoint_raw[0])],xpoint_raw,32);
if(r) {
bloom_counter++;
/* Lookup for the xpoint_raw into the full sorted list*/
@ -2331,7 +2335,7 @@ void *thread_process_bsgs_random(void *vargp) {
gmp_sprintf(xpoint_str,"%0.64Zx",BSGS_S.x);
hexs2bin(xpoint_str,(unsigned char*)xpoint_raw);
r = bloom_check(&bloom_bP[((unsigned char)xpoint_raw[0])],xpoint_raw,32);
r = custombloom_check(&bloom_bP[((unsigned char)xpoint_raw[0])],xpoint_raw,32);
if(r) {
bloom_counter++;
/* Lookup for the xpoint_raw into the full sorted list*/
@ -2433,7 +2437,7 @@ int bsgs_secondcheck(mpz_t start_range,uint32_t a,struct Point *target,mpz_t *pr
do {
gmp_sprintf(xpoint_str,"%0.64Zx",BSGS_S.x);
hexs2bin(xpoint_str,(unsigned char*)xpoint_raw);
r = bloom_check(&bloom_bPx2nd,xpoint_raw,32);
r = custombloom_check(&bloom_bPx2nd,xpoint_raw,32);
if(r) {
//printf("bloom_bPx2nd MAYBE!!\n");
/* Lookup for the xpoint_raw into the full sorted list*/
@ -2505,12 +2509,12 @@ void *thread_bPload(void *vargp) {
gmp_sprintf(hexvalue,"%0.64Zx",P.x);
hexs2bin(hexvalue,(unsigned char*) rawvalue );
if(i < bsgs_m2) {
memcpy(bPtable[j].value,rawvalue,BSGS_XVALUE_RAM);
memcpy(bPtable[j].value,rawvalue+16,BSGS_XVALUE_RAM);
bPtable[j].index = j;
bloom_add(&bloom_bPx2nd, rawvalue, BSGS_BUFFERXPOINTLENGTH);
custombloom_add(&bloom_bPx2nd, rawvalue, BSGS_BUFFERXPOINTLENGTH);
j++;
}
bloom_add(&bloom_bP[((uint8_t)rawvalue[0])], rawvalue ,BSGS_BUFFERXPOINTLENGTH);
custombloom_add(&bloom_bP[((uint8_t)rawvalue[0])], rawvalue ,BSGS_BUFFERXPOINTLENGTH);
Point_Addition(&G,&temp,&P);
i++;
tt->counter++;
@ -2545,12 +2549,12 @@ void *thread_bPloadFile(void *vargp) {
do {
if(fread(rawvalue,1,32,fd) == 32) {
if(i < bsgs_m2) {
memcpy(bPtable[j].value,rawvalue,BSGS_XVALUE_RAM);
memcpy(bPtable[j].value,rawvalue+16,BSGS_XVALUE_RAM);
bPtable[j].index = j;
bloom_add(&bloom_bPx2nd, rawvalue, BSGS_BUFFERXPOINTLENGTH);
custombloom_add(&bloom_bPx2nd, rawvalue, BSGS_BUFFERXPOINTLENGTH);
j++;
}
bloom_add(&bloom_bP[((uint8_t)rawvalue[0])], rawvalue ,BSGS_BUFFERXPOINTLENGTH);
custombloom_add(&bloom_bP[((uint8_t)rawvalue[0])], rawvalue ,BSGS_BUFFERXPOINTLENGTH);
i++;
tt->counter++;
}