-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathRSA.hpp
44 lines (34 loc) · 953 Bytes
/
RSA.hpp
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
//
// RSA.hpp
//
// Created by Nora on 1/31/16.
// Copyright © 2016 Nora. All rights reserved.
//
#ifndef RSA_hpp
#define RSA_hpp
#include <stdio.h> /* printf, NULL */
#include <stdlib.h> /* srand, rand */
#include <string>
#include <fstream>
#include <iostream>
#include "BigIntegerLibrary.hpp"
class RSA{
private:
BigInteger p, q, n, φ, e, d;
int sizeInBits;
public:
RSA();
RSA(int primeLeastSizeInBits);
~RSA();
void assignValues(bool firstTime);
BigInteger generateRandomPrime(int primeLeastSizeInBits);
BigInteger bigIntegerWithSize();
bool isPrime(BigInteger p);
BigInteger nextRandom(BigInteger b);
BigInteger generateRandomLessThan(BigInteger p);
void evaluateAll();
bool generate_e_d();
std::string towBigIntegersToString(BigInteger& first, BigInteger& second);
void writeToFile(std::string fileName, std::string content);
};
#endif /* RSA_hpp */