Crypto++  5.6.5
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 /// \brief TTMAC message authentication code information
16 class CRYPTOPP_NO_VTABLE TTMAC_Base : public FixedKeyLength<20>, public IteratedHash<word32, LittleEndian, 64, MessageAuthenticationCode>
17 {
18 public:
19  static std::string StaticAlgorithmName() {return std::string("Two-Track-MAC");}
20  CRYPTOPP_CONSTANT(DIGESTSIZE=20)
21 
22  unsigned int DigestSize() const {return DIGESTSIZE;};
23  void UncheckedSetKey(const byte *userKey, unsigned int keylength, const NameValuePairs &params);
24  void TruncatedFinal(byte *mac, size_t size);
25 
26 protected:
27  static void Transform (word32 *digest, const word32 *X, bool last);
28  void HashEndianCorrectedBlock(const word32 *data) {Transform(m_digest, data, false);}
29  void Init();
30  word32* StateBuf() {return m_digest;}
31 
34 };
35 
36 /// \brief Two-Track-MAC message authentication code
37 /// \tparam T HashTransformation class
38 /// \details 160-bit MAC with 160-bit key
39 /// \sa MessageAuthenticationCode(), <a href="http://www.weidai.com/scan-mirror/mac.html#TTMAC">Two-Track-MAC</a>
41 
42 NAMESPACE_END
43 
44 #endif
const char * DigestSize()
int, in bytes
Definition: argnames.h:79
Interface for message authentication codes.
Definition: cryptlib.h:1244
Inherited by keyed algorithms with fixed key length.
Definition: seckey.h:146
TTMAC message authentication code information.
Definition: ttmac.h:16
Converts an enumeration to a type suitable for use as a template parameter.
Definition: cryptlib.h:133
Two-Track-MAC message authentication code.
Definition: ttmac.h:40
Classes and functions for secure memory allocations.
Classes and functions for implementing secret key algorithms.
Iterated hash base class.
Definition: iterhash.h:112
Crypto++ library namespace.
Interface for retrieving values given their names.
Definition: cryptlib.h:291