2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-05-31 17:30:54 +00:00
qpdf/libqpdf/qpdf/MD5_native.hh

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

33 lines
731 B
C++
Raw Permalink Normal View History

2019-11-04 02:22:03 +00:00
#ifndef MD5_NATIVE_HH
#define MD5_NATIVE_HH
#include <qpdf/qpdf-config.h>
2019-11-04 02:22:03 +00:00
#include <cstdint>
#include <cstring>
2019-11-04 02:22:03 +00:00
class MD5_native
{
public:
typedef unsigned char Digest[16];
2019-11-04 02:22:03 +00:00
MD5_native();
void init();
void update(unsigned char*, size_t);
2019-11-04 02:22:03 +00:00
void finalize();
void digest(Digest);
2019-11-04 02:22:03 +00:00
private:
static void transform(uint32_t[4], unsigned char[64]);
static void encode(unsigned char*, uint32_t*, size_t);
static void decode(uint32_t*, unsigned char*, size_t);
uint32_t state[4]; // state (ABCD)
uint32_t count[2]; // number of bits, modulo 2^64 (lsb first)
unsigned char buffer[64]; // input buffer
bool finalized;
Digest digest_val;
};
2019-11-04 02:22:03 +00:00
#endif // MD5_NATIVE_HH