Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:55:10

0001 // ttmac.h - written and placed in the public domain by Kevin Springle

0002 
0003 /// \file ttmac.h

0004 /// \brief Classes for the TTMAC message authentication code

0005 
0006 #ifndef CRYPTOPP_TTMAC_H
0007 #define CRYPTOPP_TTMAC_H
0008 
0009 #include "seckey.h"
0010 #include "iterhash.h"
0011 #include "secblock.h"
0012 
0013 NAMESPACE_BEGIN(CryptoPP)
0014 
0015 /// \brief TTMAC message authentication code information

0016 class CRYPTOPP_NO_VTABLE TTMAC_Base : public FixedKeyLength<20>, public IteratedHash<word32, LittleEndian, 64, MessageAuthenticationCode>
0017 {
0018 public:
0019     static std::string StaticAlgorithmName() {return std::string("Two-Track-MAC");}
0020     CRYPTOPP_CONSTANT(DIGESTSIZE=20);
0021 
0022     unsigned int DigestSize() const {return DIGESTSIZE;};
0023     void UncheckedSetKey(const byte *userKey, unsigned int keylength, const NameValuePairs &params);
0024     void TruncatedFinal(byte *mac, size_t size);
0025 
0026 protected:
0027     static void Transform (word32 *digest, const word32 *X, bool last);
0028     void HashEndianCorrectedBlock(const word32 *data) {Transform(m_digest, data, false);}
0029     void Init();
0030     word32* StateBuf() {return m_digest;}
0031 
0032     FixedSizeSecBlock<word32, 10> m_digest;
0033     FixedSizeSecBlock<word32, 5> m_key;
0034 };
0035 
0036 /// \brief Two-Track-MAC message authentication code

0037 /// \tparam T HashTransformation class

0038 /// \details 160-bit MAC with 160-bit key

0039 /// \sa MessageAuthenticationCode(), <a href="http://www.weidai.com/scan-mirror/mac.html#TTMAC">Two-Track-MAC</a>

0040 DOCUMENTED_TYPEDEF(MessageAuthenticationCodeFinal<TTMAC_Base>, TTMAC);
0041 
0042 NAMESPACE_END
0043 
0044 #endif