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
¶ms);
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
33
FixedSizeSecBlock<word32, 10>
m_digest;
34
FixedSizeSecBlock<word32, 5>
m_key;
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>
42
DOCUMENTED_TYPEDEF(
MessageAuthenticationCodeFinal<TTMAC_Base>
,
TTMAC
)
43
44
NAMESPACE_END
45
46
#endif
EnumToType
Converts a typename to an enumerated value.
Definition:
cryptlib.h:115
secblock.h
Classes and functions for secure memory allocations.
FixedKeyLength
Inherited by keyed algorithms with fixed key length.
Definition:
seckey.h:128
TTMAC
Two-Track-MAC message authentication code.
Definition:
ttmac.h:42
seckey.h
Classes and functions for implementing secret key algorithms.
FixedSizeSecBlock< word32, 10 >
TTMAC_Base
TTMAC message authentication code information.
Definition:
ttmac.h:17
CryptoPP
Crypto++ library namespace.
MessageAuthenticationCode
Interface for message authentication codes.
Definition:
cryptlib.h:1107
MessageAuthenticationCodeFinal< TTMAC_Base >
NameValuePairs
Interface for retrieving values given their names.
Definition:
cryptlib.h:277
IteratedHash
_
Definition:
iterhash.h:55
Generated on Tue Mar 24 2020 14:05:48 for Crypto++ by
1.8.17