35#include <sptk5/sptk.h>
36#include <sptk5/String.h>
114 using uint1 = uint8_t;
119 using uint4 = uint32_t;
124 static constexpr int blocksize = 64;
129 void transform(
const uint1* block);
134 static void decode(uint4* output,
const uint1* input,
size_type len);
139 static void encode(uint1* output,
const uint4* input,
size_type len);
144 bool finalized {
false};
149 std::array<uint1, blocksize> buffer {};
154 std::array<uint4, 2> count {};
159 std::array<uint4, 4> state {};
164 std::array<uint1, 16> digest {};
168 static inline uint4 F(uint4 x, uint4 y, uint4 z);
170 static inline uint4 G(uint4 x, uint4 y, uint4 z);
172 static inline uint4 H(uint4 x, uint4 y, uint4 z);
174 static inline uint4 I(uint4 x, uint4 y, uint4 z);
176 static inline uint4 rotate_left(uint4 x,
int n);
178 static inline void FF(uint4& a, uint4 b, uint4 c, uint4 d, uint4 x, uint4 s, uint4 ac);
180 static inline void GG(uint4& a, uint4 b, uint4 c, uint4 d, uint4 x, uint4 s, uint4 ac);
182 static inline void HH(uint4& a, uint4 b, uint4 c, uint4 d, uint4 x, uint4 s, uint4 ac);
184 static inline void II(uint4& a, uint4 b, uint4 c, uint4 d, uint4 x, uint4 s, uint4 ac);
190 SP_EXPORT String md5(
const Buffer& data);
195 SP_EXPORT String md5(
const String& data);
friend std::ostream & operator<<(std::ostream &, MD5 md5)
void update(const char *buffer, size_type length)
unsigned int size_type
Definition: md5.h:59
void update(const unsigned char *buffer, size_type length)