Crypto++ 8.2
Free C&
md2.h
Go to the documentation of this file.
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
13NAMESPACE_BEGIN(CryptoPP)
14
15namespace Weak1 {
16
17/// \brief MD2 message digest
18/// \sa <a href="http://www.cryptolounge.org/wiki/MD2">MD2</a>
19/// \since Crypto++ 3.0
20class MD2 : public HashTransformation
21{
22public:
23 MD2();
24 void Update(const byte *input, size_t length);
25 void TruncatedFinal(byte *hash, size_t size);
26 unsigned int DigestSize() const {return DIGESTSIZE;}
27 unsigned int BlockSize() const {return BLOCKSIZE;}
28 CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "MD2";}
29
30 CRYPTOPP_CONSTANT(DIGESTSIZE = 16)
31 CRYPTOPP_CONSTANT(BLOCKSIZE = 16)
32
33private:
34 void Transform();
35 void Init();
36 SecByteBlock m_X, m_C, m_buf;
37 unsigned int m_count;
38};
39
40}
41#if CRYPTOPP_ENABLE_NAMESPACE_WEAK >= 1
42namespace Weak {using namespace Weak1;} // import Weak1 into CryptoPP::Weak
43#else
44using namespace Weak1; // import Weak1 into CryptoPP with warning
45#ifdef __GNUC__
46#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."
47#else
48#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.")
49#endif
50#endif
51
52NAMESPACE_END
53
54#endif
Interface for hash functions and data processing part of MACs.
Definition: cryptlib.h:1085
SecBlock<byte> typedef.
Definition: secblock.h:1058
MD2 message digest.
Definition: md2.h:21
unsigned int DigestSize() const
Provides the digest size of the hash.
Definition: md2.h:26
unsigned int BlockSize() const
Provides the block size of the compression function.
Definition: md2.h:27
Abstract base classes that provide a uniform interface to this library.
Crypto++ library namespace.
Namespace containing weak and wounded algorithms.
Definition: arc4.cpp:14
Classes and functions for secure memory allocations.