-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathrsa.h
More file actions
35 lines (28 loc) · 649 Bytes
/
Copy pathrsa.h
File metadata and controls
35 lines (28 loc) · 649 Bytes
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
#ifndef RSA_H
#define RSA_H
#include<vector>
#include<string>
#include <math.h>
#include <iostream>
class RSA{
public:
RSA();
int get_private_key();
std::vector<int> get_public_keys();
std::vector<int> chy(std::string string);
std::string unchy(std::string string);
private:
void generate_keys();
int generate_private_key();
bool isprime(int n);
int totient(int n);
int generate_prime();
int generate_random(int from=2, int to=pow(2, 10));
int generate_e();
int mdc(int x, int y);
int mod(int x, int y);
int ord(char c);
char chr(int i);
int p, q, n, toti_n, e, d;
};
#endif