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
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
00034 typedef MessageAuthenticationCodeTemplate<MD5MAC_Base> MD5MAC;
00035
00036 NAMESPACE_END
00037
00038
#endif