www.pudn.com > CipherSystem.rar > IDEACipherSystem.h
#ifndef IDEA_CIPHER_SYSTEM_H #define IDEA_CIPHER_SYSTEM_H #include "MyCipherSystem.h" #include "GlobalFunctions.h" #include#include using std::deque; using std::string; typedef deque binary_stream; class IDEACipherSystem : public EncryptSystem { public: //ensure the input stream is the multiple of eight void GetData(const string& input); void GetKey(const string& key); void Encrypt(); void Decrypt(); private: //influence the subKeyStored void SubKeyCreation(const binary_stream& keyBinaryStream128bit); //influence the subKeyStored which has been influenced by the SubKeyCreation void SubKeyModifyForDecrypt(); //influence the subDataBlock void SetSubDataBlock(const binary_stream& textBinaryStream64bit); //input: subKeyStored & subDataBlock //output: no return but change the value of the subDataBlock16bit array; void Iterative(); int BinaryStreamToInt(const binary_stream& binaryStream16bit); void IntToBinaryStream(int result, binary_stream& binaryStream16bit); //mod 65537 mul int MulMod65537(int muled, int mul); int AddMod65536(int added, int add); int AddMod2(int added, int add); int AthwartMul(int x); int AthwartAdd(int x); private: static const int MOD_ADD_2_16 = 65536; static const int MOD_MUL_2_16_1 = 65537; static const int MOD_ADD_2 = 2; int subKeyStored16bit[52]; int subDataBlock16bit[4]; binary_stream keyBinaryStream; }; #endif //IDEA_CIPHER_SYSTEM_H