forked from 1inch/profanity2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMode.hpp
More file actions
62 lines (49 loc) · 1.48 KB
/
Copy pathMode.hpp
File metadata and controls
62 lines (49 loc) · 1.48 KB
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
59
60
61
62
#ifndef HPP_MODE
#define HPP_MODE
#include <string>
#if defined(__APPLE__) || defined(__MACOSX)
#include <OpenCL/cl.h>
#else
#include <CL/cl.h>
#endif
// What a mode hands the scoring kernel. Wide enough for one entry per address
// nibble, plus the one that marks where a mask shorter than an address ends.
#define PROFANITY_MODE_DATA 41
enum HashTarget {
ADDRESS,
CONTRACT,
CREATE2,
HASH_TARGET_COUNT
};
class Mode {
private:
Mode();
public:
static Mode matching(const std::string strHex);
static Mode range(const cl_uchar min, const cl_uchar max);
static Mode leading(const char charLeading);
static Mode leadingRange(const cl_uchar min, const cl_uchar max);
static Mode mirror();
static Mode benchmark();
static Mode zeros();
static Mode zeroBytes();
static Mode letters();
static Mode numbers();
static Mode doubles();
std::string name;
// The scoring function this mode grades an address with, named as the
// kernels spell it — "matching", "leading", and so on. Which kernel
// actually runs it depends on where the address being graded comes
// from as well, so the name of one is built rather than stored: see
// kernelName().
std::string scorer;
HashTarget target;
// Address, Contract, ...
std::string transformName() const;
// The kernel that grades this mode against this target.
std::string kernelName() const;
cl_uchar data1[PROFANITY_MODE_DATA];
cl_uchar data2[PROFANITY_MODE_DATA];
cl_uchar score;
};
#endif /* HPP_MODE */