-
Notifications
You must be signed in to change notification settings - Fork 3
/
ecc.h
47 lines (34 loc) · 1023 Bytes
/
ecc.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
#ifndef _ECC
#define _ECC
/*#define DEBUG*/
#include "point.h"
#include "watches.h"
struct EllipticCurve {
BigInt p;
BigInt a;
BigInt b;
BigInt order;
EllipticCurve() {}
EllipticCurve(const BigInt p,
const BigInt a,
const BigInt b,
const BigInt order) :
p(p), a(a), b(b), order(order) {}
};
extern void ecc_description(const EllipticCurve ec);
extern int ecc_add(Point& R,
const EllipticCurve ec,
const Point P,
const Point Q);
extern int ecc_mul(Point& R,
const EllipticCurve ec,
const BigInt,
const Point P);
extern int ecc_halving(Point& R,
const EllipticCurve ec,
const Point P);
extern BigInt _lambda(const EllipticCurve ec,
const Point P,
const Point Q);
extern BigInt modInverse(BigInt a, BigInt m);
#endif