Crypto++
|
00001 #ifndef CRYPTOPP_MD2_H 00002 #define CRYPTOPP_MD2_H 00003 00004 #include "cryptlib.h" 00005 #include "secblock.h" 00006 00007 NAMESPACE_BEGIN(CryptoPP) 00008 00009 namespace Weak1 { 00010 00011 /// <a href="http://www.cryptolounge.org/wiki/MD2">MD2</a> 00012 class MD2 : public HashTransformation 00013 { 00014 public: 00015 MD2(); 00016 void Update(const byte *input, size_t length); 00017 void TruncatedFinal(byte *hash, size_t size); 00018 unsigned int DigestSize() const {return DIGESTSIZE;} 00019 unsigned int BlockSize() const {return BLOCKSIZE;} 00020 static const char * StaticAlgorithmName() {return "MD2";} 00021 00022 CRYPTOPP_CONSTANT(DIGESTSIZE = 16) 00023 CRYPTOPP_CONSTANT(BLOCKSIZE = 16) 00024 00025 private: 00026 void Transform(); 00027 void Init(); 00028 SecByteBlock m_X, m_C, m_buf; 00029 unsigned int m_count; 00030 }; 00031 00032 } 00033 #if CRYPTOPP_ENABLE_NAMESPACE_WEAK >= 1 00034 namespace Weak {using namespace Weak1;} // import Weak1 into CryptoPP::Weak 00035 #else 00036 using namespace Weak1; // import Weak1 into CryptoPP with warning 00037 #ifdef __GNUC__ 00038 #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." 00039 #else 00040 #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.") 00041 #endif 00042 #endif 00043 00044 NAMESPACE_END 00045 00046 #endif