1 #ifndef _AESCRPYPT_H_INCLUDED_ 2 #define _AESCRPYPT_H_INCLUDED_ 3 /////////////////////////////////////////////////////////////////////////////// 4 // 5 // AESCrypt.h 6 // ---------- 7 // AES encryption class 8 // 9 // Design and Implementation by Bjoern Lemke 10 // 11 // (C)opyright 2010-2016 Bjoern Lemke 12 // 13 // INTERFACE MODULE 14 // 15 // Class: AESCrpyt 16 // 17 // Description: AES encryption 18 // The code has been derived from 19 // 20 // Niyaz PK 21 // E-mail: niyazpk@gmail.com 22 // Downloaded from Website: www.hoozi.com 23 // 24 // Status: CLEAN 25 // 26 /////////////////////////////////////////////////////////////////////////////// 27 28 // INCLUDES 29 #include "Chain.h" 30 31 class AESCrypt { 32 33 public: 34 35 AESCrypt(); 36 AESCrypt(const Chain& key, int keyLen); 37 ~AESCrypt(); 38 39 Chain encrypt(const Chain& val); 40 41 // AESCrypt& operator = ( const AESCrypt& cy); 42 // bool operator == ( const AESCrypt& cy) const; 43 44 private: 45 46 // int _keyLen; 47 // Chain _keyString; 48 49 unsigned char getSBoxValue(int num); 50 unsigned char getRconValue(int num); 51 52 void KeyExpansion(); 53 void AddRoundKey(int round); 54 void SubBytes(); 55 void ShiftRows(); 56 void MixColumns(); 57 void Cipher(); 58 unsigned char xtime(unsigned char x); 59 60 int _Nr; 61 int _Nk; 62 63 // in - it is the array that holds the plain text to be encrypted. 64 // out - it is the array that holds the output CipherText after encryption. 65 // state - the array that holds the intermediate results during encryption. 66 unsigned char _in[16], _out[16], _state[4][4]; 67 68 // The array that stores the round keys. 69 unsigned char _RoundKey[240]; 70 71 // The Key input to the AES Program 72 unsigned char _Key[32]; 73 }; 74 #endif 75 76 77 78