-
Notifications
You must be signed in to change notification settings - Fork 4
/
cipher.h
39 lines (32 loc) · 931 Bytes
/
cipher.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
#ifndef CIPHER_H
#define CIPHER_H
#include <vector>
#include <string>
typedef unsigned char BYTE;
typedef unsigned short int WORD;
#define KEY128 10
using std::vector;
using std::string;
class Cipher
{
private:
static BYTE sBox[256];
static BYTE isBox[256];
static BYTE rcon[10];
static vector<BYTE>key;
static vector< vector<BYTE> > keys;
static void subBytes(string &data, bool operation);
static void shiftRows(string &data, bool operation);
static void padBytes(string &data);
static void mixColumns(string &data, bool operation);
static void generateFirstRow(int roundNr, BYTE tab[]);
static void addRoundKey(int roundNr, string &data);
static void keySchedule();
static void rotWord(BYTE tab[4]);
static BYTE GMul(BYTE a, BYTE b);
public:
Cipher() = delete;
static void encrypt(string &data);
static void decrypt(string &data);
};
#endif // CIPHER_H