-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaes.h
46 lines (35 loc) · 930 Bytes
/
aes.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
//
// AES
//
//
//
//
class AES {
private:
int Nr ; // Number of ROunds
int Nk ; // Number of 32-bit words in the key
unsigned char RoundKey[240]; // Round Keys
unsigned char state[4][4]; // Intermediate State
private:
int getSBoxValue(int num) ;
int getSBoxInvert(int num) ;
int getRConValue(int num) ;
void KeyExpansion(unsigned char *Key) ;
void AddRoundKey(int round) ;
void SubBytes() ;
void ShiftRows() ;
void MixColumns() ;
void InvSubBytes() ;
void InvShiftRows() ;
void InvMixColumns() ;
public:
AES(int keylen) ;
~AES() ;
private:
// Unused copy construct
AES(AES& other) ;
AES& operator= (const AES &rhs) ;
public:
void encrypt(unsigned char *key, unsigned char *in, unsigned char *out) ;
void decrypt(unsigned char *key, unsigned char *in, unsigned char *out) ;
} ;