📄 aes.h
字号:
//enum KeySize { Bits128, Bits192, Bits256 }; // key size, in bits, for construtor
#define Bits128 0
#define Bits192 1
#define Bits256 2
class Aes // Advanced Encryption Standard
{
public:
~Aes();
//Aes();
Aes(int keySize, char* keyBytes);
private:
int Nb; // block size in 32-bit words. Always 4 for AES. (128 bits).
int Nk; // key size in 32-bit words. 4, 6, 8. (128, 192, 256 bits).
int Nr; // number of rounds. 10, 12, 14.
char* key; // the seed key. size will be 4 * keySize from ctor.
char* Sbox; // Substitution box
char* iSbox; // inverse Substitution box
char* w; // key schedule array.
char* Rcon; // Round constants.
char* State; // State matrix
void Cipher(char* input, char* output); // encipher 16-bit input
InvCipher(char* input, char* output); // decipher 16-bit input
SetNbNkNr(int keyS);
BuildSbox();
BuildInvSbox();
BuildRcon();
AddRoundKey(int round);
SubBytes();
InvSubBytes();
ShiftRows();
InvShiftRows();
MixColumns();
InvMixColumns();
gfmultby01(char b);
gfmultby02(char b);
gfmultby03(char b);
gfmultby09(char b);
gfmultby0b(char b);
gfmultby0d(char b);
gfmultby0e(char b);
KeyExpansion();
SubWord(char* word);
RotWord(char* word);
Dump();
DumpKey();
DumpTwoByTwo(char* a);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -