-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.h
57 lines (46 loc) · 1.15 KB
/
main.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
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>
#include <gmp.h>
#define INF 1
#define nPoints 20
struct coord
{
mpz_t x;
mpz_t y;
int inf;
};
struct parameters{
mpz_t p;
mpz_t a;
mpz_t b;
struct coord G;
mpz_t n;
// unsigned int h; // não é útil
};
struct pe
{
struct coord pu;
mpz_t k;
mpz_t k_sess;
};
struct parameters ec; // parâmetros globais
struct coord points[nPoints]; //pontos[índice do char]
struct pe alice; // chave pública e privada
struct pe bob; // chave pública e privada
void showPoints();
void showPoint(struct coord p);
void modn(mpz_t rop, mpz_t a);
void modp(mpz_t rop, mpz_t a);
void eccDbl(struct coord *rop, struct coord p);
void eccAdd(struct coord *rop, struct coord p, struct coord q);
void eccSub(struct coord *rop, struct coord p, struct coord q);
void mult(struct coord *rop, mpz_t k, struct coord p);
void euclidian(mpz_t rop, mpz_t a);
void multInv(mpz_t rop, mpz_t a);
void generateKeys();
bool isValidPoint(mpz_t x, mpz_t y);
void findPoints();
void eccCipher(struct coord *c2, struct coord *c1, int size);
void eccDecipher(struct coord *d, struct coord *c2, struct coord c1, int s);