-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbf.hpp
58 lines (46 loc) · 1.79 KB
/
bf.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#pragma once
#include "keccak-tiny.h"
#include <secp256k1.h>
#include <sodium.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <time.h>
#include <string>
#include <map>
#include <vector>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#define PRIVATE_KEY_SIZE 32
#define ADDRESS_SIZE 20
class c_bf {
public:
std::map<std::vector<unsigned char>, int> look_array_eth;
std::map<std::string, int> look_array_btc;
std::map<std::vector<unsigned char>, int> look_array_btc_p;
long long int cpt = 0;
unsigned char * pattern_mode = NULL;
int pattern_len = 0;
secp256k1_context * p_eth_ctx;
secp256k1_context * p_btc_ctx;
int p_complexity = 0;
void gen_eth_key_pair(unsigned char *priv, unsigned char *address,
std::vector<unsigned char> & e);
void gen_btc_key_pair(unsigned char *priv, unsigned char *address);
void gen_btc_pub(unsigned char *priv, unsigned char *pub,
std::vector<unsigned char> & e);
void print_key(unsigned char *key, int len, std::string label);
std::string bin_to_str(unsigned char *key, int len);
c_bf() {
//p_eth_ctx = secp256k1_context_create(SECP256K1_CONTEXT_NONE);
p_eth_ctx = secp256k1_context_create(SECP256K1_CONTEXT_SIGN);
p_btc_ctx = secp256k1_context_create(SECP256K1_CONTEXT_SIGN | SECP256K1_CONTEXT_VERIFY);
}
~c_bf() {
secp256k1_context_destroy(p_eth_ctx);
secp256k1_context_destroy(p_btc_ctx);
}
};
extern c_bf *p_bf;