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

md5mac.h

Go to the documentation of this file.
00001 #ifndef CRYPTOPP_MD5MAC_H
00002 #define CRYPTOPP_MD5MAC_H
00003 
00004 /** \file
00005 */
00006 
00007 #include "seckey.h"
00008 #include "iterhash.h"
00009 
00010 NAMESPACE_BEGIN(CryptoPP)
00011 
00012 //! .
00013 class MD5MAC_Base : public FixedKeyLength<16>, public IteratedHash<word32, LittleEndian, 64, MessageAuthenticationCode>
00014 {
00015 public:
00016         static std::string StaticAlgorithmName() {return "MD5-MAC";}
00017         enum {DIGESTSIZE = 16};
00018 
00019         MD5MAC_Base() : IteratedHash<word32, LittleEndian, 64, MessageAuthenticationCode>(DIGESTSIZE) {}
00020 
00021         void UncheckedSetKey(const byte *userKey, unsigned int keylength);
00022         void TruncatedFinal(byte *mac, unsigned int size);
00023 
00024 protected:
00025         static void Transform (word32 *buf, const word32 *in, const word32 *key);
00026         void vTransform(const word32 *data) {Transform(m_digest, data, m_key+4);}
00027         void Init();
00028 
00029         static const word32 T[12];
00030         FixedSizeSecBlock<word32, 12> m_key;
00031 };
00032 
00033 //! <a href="http://www.weidai.com/scan-mirror/mac.html#MD5-MAC">MD5-MAC</a>
00034 typedef MessageAuthenticationCodeTemplate<MD5MAC_Base> MD5MAC;
00035 
00036 NAMESPACE_END
00037 
00038 #endif

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