forked from 1inch/profanity2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.hpp
More file actions
58 lines (50 loc) · 1.68 KB
/
Copy pathtypes.hpp
File metadata and controls
58 lines (50 loc) · 1.68 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
#ifndef HPP_TYPES
#define HPP_TYPES
/* The structs declared in this file should have size/alignment hints
* to ensure that their representation is identical to that in OpenCL.
*/
#if defined(__APPLE__) || defined(__MACOSX)
#include <OpenCL/cl.h>
#else
#include <CL/cl.h>
#endif
#define MP_NWORDS 8
typedef cl_uint mp_word;
typedef struct alignas(16) {
mp_word d[MP_NWORDS];
} mp_number;
typedef struct {
mp_number x;
mp_number y;
} point;
// foundVariant says which of the addresses a point yields this result was, and
// so what has to be done to the private key behind it; foundRound which of the
// launch's point additions it turned up at, every one of which is a different
// scalar. Kept in step with the same struct in profanity.cl.
typedef struct {
cl_uint found;
cl_uint foundId;
cl_uint foundRound;
cl_uint foundVariant;
cl_uchar foundHash[20];
} result;
// The six addresses one point addition can be worth, and what each does to the
// scalar a search prints to reach the private key behind it. λ is the scalar
// the curve's endomorphism multiplies by, and n the order of the curve.
//
// POINT s the scalar unchanged
// NEGATED -s
// LAMBDA λs
// LAMBDA_NEGATED -λs
// LAMBDA2 λ²s
// LAMBDA2_NEGATED -λ²s
//
// all taken mod n. Which of them a search can find depends on what it was
// built to look at: one, the first; two, the first pair; six, all of them.
#define PROFANITY_VARIANT_POINT 0
#define PROFANITY_VARIANT_NEGATED 1
#define PROFANITY_VARIANT_LAMBDA 2
#define PROFANITY_VARIANT_LAMBDA_NEGATED 3
#define PROFANITY_VARIANT_LAMBDA2 4
#define PROFANITY_VARIANT_LAMBDA2_NEGATED 5
#endif /* HPP_TYPES */