Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | 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 enum {DIGESTSIZE=20}; 00017 00018 TTMAC_Base() {SetStateSize(DIGESTSIZE*2);} 00019 00020 unsigned int DigestSize() const {return DIGESTSIZE;}; 00021 void UncheckedSetKey(const byte *userKey, unsigned int keylength); 00022 void TruncatedFinal(byte *mac, unsigned int size); 00023 00024 protected: 00025 static void Transform (word32 *digest, const word32 *X, bool last); 00026 void HashEndianCorrectedBlock(const word32 *data) {Transform(m_digest, data, false);} 00027 void Init(); 00028 00029 FixedSizeSecBlock<word32, DIGESTSIZE> 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

Generated on Fri Aug 27 14:01:34 2004 for Crypto++ by doxygen 1.3.8