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 //! _
00013 struct Rijndael_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 32, 8>
00014 {
00015         CRYPTOPP_DLL static const char * CRYPTOPP_API StaticAlgorithmName() {return CRYPTOPP_RIJNDAEL_NAME;}
00016 };
00017 
00018 /// <a href="http://www.weidai.com/scan-mirror/cs.html#Rijndael">Rijndael</a>
00019 class CRYPTOPP_DLL Rijndael : public Rijndael_Info, public BlockCipherDocumentation
00020 {
00021         class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<Rijndael_Info>
00022         {
00023         public:
00024                 void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs &params);
00025 
00026         protected:
00027                 // VS2005 workaround: have to put these on seperate lines, or error C2487 is triggered in DLL build
00028                 static const byte Se[256];
00029                 static const byte Sd[256];
00030                 static const word32 Te[4*256];
00031                 static const word32 Td[4*256];
00032 
00033                 static const word32 rcon[];
00034 
00035                 unsigned int m_rounds;
00036                 SecBlock<word32> m_key;
00037         };
00038 
00039         class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Enc : public Base
00040         {
00041         public:
00042                 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
00043         };
00044 
00045         class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Dec : public Base
00046         {
00047         public:
00048                 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
00049         };
00050 
00051 public:
00052         typedef BlockCipherFinal<ENCRYPTION, Enc> Encryption;
00053         typedef BlockCipherFinal<DECRYPTION, Dec> Decryption;
00054 };
00055 
00056 typedef Rijndael::Encryption RijndaelEncryption;
00057 typedef Rijndael::Decryption RijndaelDecryption;
00058 
00059 NAMESPACE_END
00060 
00061 #endif

Generated on Fri Jun 1 11:11:24 2007 for Crypto++ by  doxygen 1.5.2