forked from JeanLucPons/VanitySearch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SECP256k1.h
62 lines (50 loc) · 1.76 KB
/
SECP256k1.h
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
/*
* This file is part of the VanitySearch distribution (https://github.com/JeanLucPons/VanitySearch).
* Copyright (c) 2019 Jean Luc PONS.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SECP256K1H
#define SECP256K1H
#include "Point.h"
#include <string>
#include <vector>
class Secp256K1 {
public:
Secp256K1();
~Secp256K1();
void Init();
Point ComputePublicKey(Int *privKey);
Point NextKey(Point &key);
void Check();
int EC(Point &p);
void GetHash160(bool compressed,
Point &k0, Point &k1, Point &k2, Point &k3,
uint8_t *h0, uint8_t *h1, uint8_t *h2, uint8_t *h3);
void GetHash160(Point &pubKey,bool compressed,unsigned char *hash);
std::string GetAddress(Point &pubKey,bool compressed);
std::string GetAddress(unsigned char *hash20, bool compressed);
std::string GetPrivAddress(Int &privKey);
bool CheckPudAddress(std::string address);
static Int DecodePrivateKey(char *key);
Point Add(Point &p1, Point &p2);
Point AddDirect(Point &p1, Point &p2);
Point Double(Point &p);
Point DoubleDirect(Point &p);
Point G; // Generator
Int order; // Curve order
private:
Int GetY(Int x, bool isEven);
Point GTable[256]; // Generator table
};
#endif // SECP256K1H