Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:55:04

0001 // md2.h - originally written and placed in the public domain by Wei Dai

0002 
0003 /// \file md2.h

0004 /// \brief Classes for the MD2 message digest

0005 /// \since Crypto++ 3.0

0006 
0007 #ifndef CRYPTOPP_MD2_H
0008 #define CRYPTOPP_MD2_H
0009 
0010 #include "cryptlib.h"
0011 #include "secblock.h"
0012 
0013 NAMESPACE_BEGIN(CryptoPP)
0014 
0015 namespace Weak1 {
0016 
0017 /// \brief MD2 message digest

0018 /// \sa <a href="http://www.cryptolounge.org/wiki/MD2">MD2</a>

0019 /// \since Crypto++ 3.0

0020 class MD2 : public HashTransformation
0021 {
0022 public:
0023     CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "MD2";}
0024 
0025     MD2();
0026     void Update(const byte *input, size_t length);
0027     void TruncatedFinal(byte *hash, size_t size);
0028     unsigned int DigestSize() const {return DIGESTSIZE;}
0029     unsigned int BlockSize() const {return BLOCKSIZE;}
0030     std::string AlgorithmName() const {return StaticAlgorithmName();}
0031 
0032     CRYPTOPP_CONSTANT(DIGESTSIZE = 16);
0033     CRYPTOPP_CONSTANT(BLOCKSIZE = 16);
0034 
0035 private:
0036     void Transform();
0037     void Init();
0038     SecByteBlock m_X, m_C, m_buf;
0039     unsigned int m_count;
0040 };
0041 
0042 }
0043 #if CRYPTOPP_ENABLE_NAMESPACE_WEAK >= 1
0044 namespace Weak {using namespace Weak1;}     // import Weak1 into CryptoPP::Weak

0045 #else
0046 using namespace Weak1;  // import Weak1 into CryptoPP with warning

0047 #ifdef __GNUC__
0048 #warning "You may be using a weak algorithm that has been retained for backwards compatibility. Please '#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning."
0049 #else
0050 #pragma message("You may be using a weak algorithm that has been retained for backwards compatibility. Please '#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning.")
0051 #endif
0052 #endif
0053 
0054 NAMESPACE_END
0055 
0056 #endif