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

mars.h

Go to the documentation of this file.
00001 #ifndef CRYPTOPP_MARS_H
00002 #define CRYPTOPP_MARS_H
00003 
00004 /** \file
00005 */
00006 
00007 #include "seckey.h"
00008 #include "secblock.h"
00009 
00010 NAMESPACE_BEGIN(CryptoPP)
00011 
00012 struct MARS_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 56, 4>
00013 {
00014         static const char *StaticAlgorithmName() {return "MARS";}
00015 };
00016 
00017 /// <a href="http://www.weidai.com/scan-mirror/cs.html#MARS">MARS</a>
00018 class MARS : public MARS_Info, public BlockCipherDocumentation
00019 {
00020         class Base : public BlockCipherBaseTemplate<MARS_Info>
00021         {
00022         public:
00023                 void UncheckedSetKey(CipherDir direction, const byte *userKey, unsigned int length);
00024 
00025         protected:
00026                 static const word32 Sbox[512];
00027 
00028                 FixedSizeSecBlock<word32, 40> EK;
00029         };
00030 
00031         class Enc : public Base
00032         {
00033         public:
00034                 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
00035         };
00036 
00037         class Dec : public Base
00038         {
00039         public:
00040                 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
00041         };
00042 
00043 public:
00044         typedef BlockCipherTemplate<ENCRYPTION, Enc> Encryption;
00045         typedef BlockCipherTemplate<DECRYPTION, Dec> Decryption;
00046 };
00047 
00048 typedef MARS::Encryption MARSEncryption;
00049 typedef MARS::Decryption MARSDecryption;
00050 
00051 NAMESPACE_END
00052 
00053 #endif

Generated on Sun Mar 14 20:44:27 2004 for Crypto++ by doxygen 1.3.6-20040222