-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathaes.h
More file actions
37 lines (28 loc) · 1.28 KB
/
Copy pathaes.h
File metadata and controls
37 lines (28 loc) · 1.28 KB
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
#ifndef AES_H
#define AES_H
// AES 128bit = 16 bytes
#define BYTES 16
// block size is 128 bits = 16 bytes
// so we need 4x4 blocks
#define BLOCK_SIZE 4
// aes functions prototypes
void key_schedule(unsigned int [], unsigned int [][BLOCK_SIZE]);
void add_roundkey(unsigned int [][BLOCK_SIZE], unsigned int [][BLOCK_SIZE], unsigned int [][BLOCK_SIZE]);
unsigned int sub_byte(unsigned int, unsigned int);
void shift_rows(unsigned int [][BLOCK_SIZE]);
void mix_columns(unsigned int [][BLOCK_SIZE], unsigned int [][BLOCK_SIZE]);
void encryption(unsigned int [][BLOCK_SIZE], unsigned int []);
unsigned int inv_sub_byte(unsigned int, unsigned int);
void inv_shift_rows(unsigned int [][BLOCK_SIZE]);
void inv_mix_columns(unsigned int [][BLOCK_SIZE], unsigned int [][BLOCK_SIZE]);
void decryption(unsigned int [][BLOCK_SIZE], unsigned int []);
// secondary functions
int hexCharToDec(char);
void get2Bytes(unsigned int, unsigned int *, unsigned int *);
void getRoundKey(unsigned int [], unsigned int [][BLOCK_SIZE], int);
unsigned int gfMul(unsigned int, unsigned int);
void convertStringToBlock(char [], unsigned int [][BLOCK_SIZE]);
void convertBlockToString(unsigned int [][BLOCK_SIZE], char []);
void printArray(unsigned int [][BLOCK_SIZE]);
void test();
#endif //AES_H