00001 #ifndef CRYPTOPP_MD5MAC_H
00002 #define CRYPTOPP_MD5MAC_H
00003
00004
00005
00006
00007 #include "seckey.h"
00008 #include "iterhash.h"
00009
00010 NAMESPACE_BEGIN(CryptoPP)
00011
00012 class CRYPTOPP_NO_VTABLE MD5MAC_Base : public FixedKeyLength<16>, public IteratedHash<word32, LittleEndian, 64, MessageAuthenticationCode>
00013 {
00014 public:
00015 static std::string StaticAlgorithmName() {return "MD5-MAC";}
00016 CRYPTOPP_CONSTANT(DIGESTSIZE = 16)
00017
00018 MD5MAC_Base() {SetStateSize(DIGESTSIZE);}
00019
00020 void UncheckedSetKey(const byte *userKey, unsigned int keylength, const NameValuePairs ¶ms);
00021 void TruncatedFinal(byte *mac, size_t size);
00022 unsigned int DigestSize() const {return DIGESTSIZE;}
00023
00024 protected:
00025 static void Transform (word32 *buf, const word32 *in, const word32 *key);
00026 void HashEndianCorrectedBlock(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
00034 DOCUMENTED_TYPEDEF(MessageAuthenticationCodeFinal<MD5MAC_Base>, MD5MAC)
00035
00036 NAMESPACE_END
00037
00038 #endif