Line | Count | Source (jump to first uncovered line) |
1 | | // md2.h - originally written and placed in the public domain by Wei Dai |
2 | | |
3 | | /// \file md2.h |
4 | | /// \brief Classes for the MD2 message digest |
5 | | /// \since Crypto++ 3.0 |
6 | | |
7 | | #ifndef CRYPTOPP_MD2_H |
8 | | #define CRYPTOPP_MD2_H |
9 | | |
10 | | #include "cryptlib.h" |
11 | | #include "secblock.h" |
12 | | |
13 | | NAMESPACE_BEGIN(CryptoPP) |
14 | | |
15 | | namespace Weak1 { |
16 | | |
17 | | /// \brief MD2 message digest |
18 | | /// \sa <a href="http://www.cryptolounge.org/wiki/MD2">MD2</a> |
19 | | /// \since Crypto++ 3.0 |
20 | | class MD2 : public HashTransformation |
21 | | { |
22 | | public: |
23 | 9 | CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "MD2";} |
24 | | |
25 | | MD2(); |
26 | | void Update(const byte *input, size_t length); |
27 | | void TruncatedFinal(byte *hash, size_t size); |
28 | 36.3k | unsigned int DigestSize() const {return DIGESTSIZE;} |
29 | 25.4k | unsigned int BlockSize() const {return BLOCKSIZE;} |
30 | 0 | std::string AlgorithmName() const {return StaticAlgorithmName();} |
31 | | |
32 | | CRYPTOPP_CONSTANT(DIGESTSIZE = 16); |
33 | | CRYPTOPP_CONSTANT(BLOCKSIZE = 16); |
34 | | |
35 | | private: |
36 | | void Transform(); |
37 | | void Init(); |
38 | | SecByteBlock m_X, m_C, m_buf; |
39 | | unsigned int m_count; |
40 | | }; |
41 | | |
42 | | } |
43 | | #if CRYPTOPP_ENABLE_NAMESPACE_WEAK >= 1 |
44 | | namespace Weak {using namespace Weak1;} // import Weak1 into CryptoPP::Weak |
45 | | #else |
46 | | using namespace Weak1; // import Weak1 into CryptoPP with warning |
47 | | #ifdef __GNUC__ |
48 | | #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." |
49 | | #else |
50 | | #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.") |
51 | | #endif |
52 | | #endif |
53 | | |
54 | | NAMESPACE_END |
55 | | |
56 | | #endif |