Crypto++

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

ttmac.h

    00001 // ttmac.h - written and placed in the public domain by Kevin Springle
    00002
    00003 #ifndef CRYPTOPP_TTMAC_H
    00004 #define CRYPTOPP_TTMAC_H
    00005
    00006 #include "seckey.h"
    00007 #include "iterhash.h"
    00008
    00009 NAMESPACE_BEGIN(CryptoPP)
    00010
    00011 //! _
    00012 class CRYPTOPP_NO_VTABLE TTMAC_Base : public FixedKeyLength<20>, public IteratedHash<word32, LittleEndian, 64, MessageAuthenticationCode>
    00013 {
    00014 public:
    00015     static std::string StaticAlgorithmName() {return std::string("Two-Track-MAC");}
    00016     CRYPTOPP_CONSTANT(DIGESTSIZE=20)
    00017
    00018     unsigned int DigestSize() const {return DIGESTSIZE;};
    00019     void UncheckedSetKey(const byte *userKey, unsigned int keylength, const NameValuePairs &params);
    00020     void TruncatedFinal(byte *mac, size_t size);
    00021
    00022 protected:
    00023     static void Transform (word32 *digest, const word32 *X, bool last);
    00024     void HashEndianCorrectedBlock(const word32 *data) {Transform(m_digest, data, false);}
    00025     void Init();
    00026     word32* StateBuf() {return m_digest;}
    00027
    00028     FixedSizeSecBlock<word32, 10> m_digest;
    00029     FixedSizeSecBlock<word32, 5> m_key;
    00030 };
    00031
    00032 //! <a href="http://www.weidai.com/scan-mirror/mac.html#TTMAC">Two-Track-MAC</a>
    00033 /*! 160 Bit MAC with 160 Bit Key */
    00034 DOCUMENTED_TYPEDEF(MessageAuthenticationCodeFinal<TTMAC_Base>, TTMAC)
    00035
    00036 NAMESPACE_END
    00037
    00038 #endif