Crypto++  5.6.4
Free C++ class library of cryptographic schemes
ttmac.h
Go to the documentation of this file.
1 // ttmac.h - written and placed in the public domain by Kevin Springle
2 
3 //! \file ttmac.h
4 //! \brief Classes for the TTMAC message authentication code
5 
6 #ifndef CRYPTOPP_TTMAC_H
7 #define CRYPTOPP_TTMAC_H
8 
9 #include "seckey.h"
10 #include "iterhash.h"
11 #include "secblock.h"
12 
13 NAMESPACE_BEGIN(CryptoPP)
14 
15 //! \class TTMAC_Base
16 //! \brief TTMAC message authentication code information
17 class CRYPTOPP_NO_VTABLE TTMAC_Base : public FixedKeyLength<20>, public IteratedHash<word32, LittleEndian, 64, MessageAuthenticationCode>
18 {
19 public:
20  static std::string StaticAlgorithmName() {return std::string("Two-Track-MAC");}
21  CRYPTOPP_CONSTANT(DIGESTSIZE=20)
22 
23  unsigned int DigestSize() const {return DIGESTSIZE;};
24  void UncheckedSetKey(const byte *userKey, unsigned int keylength, const NameValuePairs &params);
25  void TruncatedFinal(byte *mac, size_t size);
26 
27 protected:
28  static void Transform (word32 *digest, const word32 *X, bool last);
29  void HashEndianCorrectedBlock(const word32 *data) {Transform(m_digest, data, false);}
30  void Init();
31  word32* StateBuf() {return m_digest;}
32 
35 };
36 
37 //! \class TTMAC
38 //! \brief Two-Track-MAC message authentication code
39 //! \tparam T HashTransformation class
40 //! \details 160-bit MAC with 160-bit key
41 //! \sa MessageAuthenticationCode(), <a href="http://www.weidai.com/scan-mirror/mac.html#TTMAC">Two-Track-MAC</a>
43 
44 NAMESPACE_END
45 
46 #endif
const char * DigestSize()
int, in bytes
Definition: argnames.h:78
Interface for message authentication codes.
Definition: cryptlib.h:1114
Inherited by keyed algorithms with fixed key length.
Definition: seckey.h:128
TTMAC message authentication code information.
Definition: ttmac.h:17
Converts a typename to an enumerated value.
Definition: cryptlib.h:120
Two-Track-MAC message authentication code.
Definition: ttmac.h:42
Classes and functions for secure memory allocations.
Classes and functions for implementing secret key algorithms.
Iterated hash base class.
Definition: iterhash.h:101
Crypto++ library namespace.
Interface for retrieving values given their names.
Definition: cryptlib.h:282