From 4ec1f8462de98d1ad83bd69fbc2142ee4beab620 Mon Sep 17 00:00:00 2001 From: weidai Date: Wed, 16 Apr 2003 00:48:47 +0000 Subject: add new algorithms (Kevin Springle) git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@57 57ff6487-cd31-0410-9ec3-f628ee90f5f0 --- ttmac.h | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 ttmac.h (limited to 'ttmac.h') diff --git a/ttmac.h b/ttmac.h new file mode 100644 index 0000000..7ca7ecf --- /dev/null +++ b/ttmac.h @@ -0,0 +1,38 @@ +// ttmac.h - written and placed in the public domain by Kevin Springle + +#ifndef CRYPTOPP_TTMAC_H +#define CRYPTOPP_TTMAC_H + +#include "seckey.h" +#include "iterhash.h" + +NAMESPACE_BEGIN(CryptoPP) +//! Two-Track-MAC +/*! 160 Bit MAC with 160 Bit Key */ + +class TTMAC_Base : public FixedKeyLength<20>, public IteratedHash +{ +public: + static std::string StaticAlgorithmName() {return std::string("Two-Track-MAC");} + enum {DIGESTSIZE=20}; + + TTMAC_Base() : IteratedHash(DIGESTSIZE*2) {} + + unsigned int DigestSize() const {return DIGESTSIZE;}; + void UncheckedSetKey(const byte *userKey, unsigned int keylength); + void TruncatedFinal(byte *mac, unsigned int size); + +protected: + static void Transform (word32 *digest, const word32 *X, bool last); + void vTransform(const word32 *data) {Transform(m_digest, data, false);} + void Init(); + + FixedSizeSecBlock m_key; +}; + +//! Two-Track-MAC +typedef MessageAuthenticationCodeTemplate TTMAC; + +NAMESPACE_END + +#endif -- cgit v1.2.1