00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00024
00025 #ifndef SFML_ENCRYPTOR_HPP
00026 #define SFML_ENCRYPTOR_HPP
00027
00029
00031 #include <SFML/Config.hpp>
00032 #include <string>
00033 #include <vector>
00034
00035
00041 class sfEncryptor
00042 {
00043 public :
00044
00055 bool Encrypt(const char* Source, std::size_t Size, const char* Key);
00056
00067 bool Decrypt(const char* Source, std::size_t Size, const char* Key);
00068
00077 const char* GetData() const;
00078
00086 std::size_t GetDataSize() const;
00087
00088 private :
00089
00096 void SetupEncrypt(const unsigned char* Key);
00097
00104 void SetupDecrypt(const unsigned char* Key);
00105
00113 void EncryptBlock(const unsigned char* PlainText, unsigned char* CipherText);
00114
00122 void DecryptBlock(const unsigned char* CipherText, unsigned char* PlainText);
00123
00127 enum
00128 {
00129 NbRounds = 10
00130 };
00131
00133
00135 std::vector<char> myData;
00136 sfUint32 myRoundKey[44];
00137 };
00138
00139
00140 #endif // SFML_ENCRYPTOR_HPP