Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

mdc.h

Go to the documentation of this file.
00001  // mdc.h - written and placed in the public domain by Wei Dai
00002 
00003 #ifndef CRYPTOPP_MDC_H
00004 #define CRYPTOPP_MDC_H
00005 
00009 #include "cryptlib.h"
00010 #include "misc.h"
00011 
00012 NAMESPACE_BEGIN(CryptoPP)
00013 
00015 template <class T> class MDC : public FixedBlockSize<T::DIGESTSIZE>, public FixedKeyLength<T::BLOCKSIZE>
00016 {
00017 public:
00018         MDC(const byte *userKey, unsigned int = 0)
00019                 : key(KEYLENGTH/4)
00020         {
00021                 T::CorrectEndianess(key, (word32 *)userKey, KEYLENGTH);
00022         }
00023 
00024         void ProcessBlock(byte *inoutBlock) const
00025         {
00026                 T::CorrectEndianess((word32 *)inoutBlock, (word32 *)inoutBlock, BLOCKSIZE);
00027                 T::Transform((word32 *)inoutBlock, key);
00028                 T::CorrectEndianess((word32 *)inoutBlock, (word32 *)inoutBlock, BLOCKSIZE);
00029         }
00030 
00031         void ProcessBlock(const byte *inBlock, byte *outBlock) const
00032         {
00033                 T::CorrectEndianess((word32 *)outBlock, (word32 *)inBlock, BLOCKSIZE);
00034                 T::Transform((word32 *)outBlock, key);
00035                 T::CorrectEndianess((word32 *)outBlock, (word32 *)outBlock, BLOCKSIZE);
00036         }
00037 
00038 private:
00039         SecBlock<word32> key;
00040 };
00041 
00042 NAMESPACE_END
00043 
00044 #endif

Generated at Mon Jan 15 01:16:34 2001 for Crypto++ by doxygen1.2.4 written by Dimitri van Heesch, © 1997-2000