Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

rijndael.h

Go to the documentation of this file.
00001 #ifndef CRYPTOPP_RIJNDAEL_H
00002 #define CRYPTOPP_RIJNDAEL_H
00003 
00004 /** \file
00005 */
00006 
00007 #include "seckey.h"
00008 #include "secblock.h"
00009 
00010 NAMESPACE_BEGIN(CryptoPP)
00011 
00012 struct Rijndael_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 32, 8>
00013 {
00014         static const char *StaticAlgorithmName() {return "Rijndael";}
00015 };
00016 
00017 /// <a href="http://www.weidai.com/scan-mirror/cs.html#Rijndael">Rijndael</a>
00018 class Rijndael : public Rijndael_Info, public BlockCipherDocumentation
00019 {
00020         class Base : public BlockCipherBaseTemplate<Rijndael_Info>
00021         {
00022         public:
00023                 void UncheckedSetKey(CipherDir direction, const byte *userKey, unsigned int length);
00024 
00025         protected:
00026                 static const word32 Te0[256];
00027                 static const word32 Te1[256];
00028                 static const word32 Te2[256];
00029                 static const word32 Te3[256];
00030                 static const word32 Te4[256];
00031 
00032                 static const word32 Td0[256];
00033                 static const word32 Td1[256];
00034                 static const word32 Td2[256];
00035                 static const word32 Td3[256];
00036                 static const word32 Td4[256];
00037 
00038                 static const word32 rcon[];
00039 
00040                 unsigned int m_rounds;
00041                 SecBlock<word32> m_key;
00042         };
00043 
00044         class Enc : public Base
00045         {
00046         public:
00047                 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
00048         };
00049 
00050         class Dec : public Base
00051         {
00052         public:
00053                 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
00054         };
00055 
00056 public:
00057         typedef BlockCipherTemplate<ENCRYPTION, Enc> Encryption;
00058         typedef BlockCipherTemplate<DECRYPTION, Dec> Decryption;
00059 };
00060 
00061 typedef Rijndael::Encryption RijndaelEncryption;
00062 typedef Rijndael::Decryption RijndaelDecryption;
00063 
00064 NAMESPACE_END
00065 
00066 #endif

Generated on Mon Apr 19 18:12:32 2004 for Crypto++ by doxygen 1.3.6-20040222