56MD5::MD5 (
const unsigned char* buffer,
unsigned long len)
77 update (s.c_str(), s.size());
97 for (
int i = 0; i < 16; i++) {
98 snprintf (s+i*2, 3,
"%02x",
m_digest[i]);
112#define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z))))
113#define G(x, y, z) ((y) ^ ((z) & ((x) ^ (y))))
114#define H(x, y, z) (((x) ^ (y)) ^ (z))
115#define H2(x, y, z) ((x) ^ ((y) ^ (z)))
116#define I(x, y, z) ((y) ^ ((x) | ~(z)))
121#define STEP(f, a, b, c, d, x, t, s) \
122 (a) += f((b), (c), (d)) + (x) + (t); \
123 (a) = (((a) << (s)) | (((a) & 0xffffffff) >> (32 - (s)))); \
141#if defined(__i386__) || defined(__x86_64__) || defined(__vax__)
143 (*(MD5_u32plus *)&ptr[(n) * 4])
149 (MD5_u32plus)ptr[(n) * 4] | \
150 ((MD5_u32plus)ptr[(n) * 4 + 1] << 8) | \
151 ((MD5_u32plus)ptr[(n) * 4 + 2] << 16) | \
152 ((MD5_u32plus)ptr[(n) * 4 + 3] << 24))
163 const unsigned char *ptr;
168 ptr = (
const unsigned char *)
data;
182 STEP(
F,
a, b, c, d,
SET(0), 0xd76aa478, 7)
183 STEP(
F, d,
a, b, c,
SET(1), 0xe8c7b756, 12)
184 STEP(
F, c, d,
a, b,
SET(2), 0x242070db, 17)
185 STEP(
F, b, c, d,
a,
SET(3), 0xc1bdceee, 22)
186 STEP(
F,
a, b, c, d,
SET(4), 0xf57c0faf, 7)
187 STEP(
F, d,
a, b, c,
SET(5), 0x4787c62a, 12)
188 STEP(
F, c, d,
a, b,
SET(6), 0xa8304613, 17)
189 STEP(
F, b, c, d,
a,
SET(7), 0xfd469501, 22)
190 STEP(
F,
a, b, c, d,
SET(8), 0x698098d8, 7)
191 STEP(
F, d,
a, b, c,
SET(9), 0x8b44f7af, 12)
192 STEP(
F, c, d,
a, b,
SET(10), 0xffff5bb1, 17)
193 STEP(
F, b, c, d,
a,
SET(11), 0x895cd7be, 22)
194 STEP(
F,
a, b, c, d,
SET(12), 0x6b901122, 7)
195 STEP(
F, d,
a, b, c,
SET(13), 0xfd987193, 12)
196 STEP(
F, c, d,
a, b,
SET(14), 0xa679438e, 17)
197 STEP(
F, b, c, d,
a,
SET(15), 0x49b40821, 22)
200 STEP(
G,
a, b, c, d,
GET(1), 0xf61e2562, 5)
201 STEP(
G, d,
a, b, c,
GET(6), 0xc040b340, 9)
202 STEP(
G, c, d,
a, b,
GET(11), 0x265e5a51, 14)
203 STEP(
G, b, c, d,
a,
GET(0), 0xe9b6c7aa, 20)
204 STEP(
G,
a, b, c, d,
GET(5), 0xd62f105d, 5)
205 STEP(
G, d,
a, b, c,
GET(10), 0x02441453, 9)
206 STEP(
G, c, d,
a, b,
GET(15), 0xd8a1e681, 14)
207 STEP(
G, b, c, d,
a,
GET(4), 0xe7d3fbc8, 20)
208 STEP(
G,
a, b, c, d,
GET(9), 0x21e1cde6, 5)
209 STEP(
G, d,
a, b, c,
GET(14), 0xc33707d6, 9)
210 STEP(
G, c, d,
a, b,
GET(3), 0xf4d50d87, 14)
211 STEP(
G, b, c, d,
a,
GET(8), 0x455a14ed, 20)
212 STEP(
G,
a, b, c, d,
GET(13), 0xa9e3e905, 5)
213 STEP(
G, d,
a, b, c,
GET(2), 0xfcefa3f8, 9)
214 STEP(
G, c, d,
a, b,
GET(7), 0x676f02d9, 14)
215 STEP(
G, b, c, d,
a,
GET(12), 0x8d2a4c8a, 20)
218 STEP(
H,
a, b, c, d,
GET(5), 0xfffa3942, 4)
220 STEP(
H, c, d,
a, b,
GET(11), 0x6d9d6122, 16)
222 STEP(
H,
a, b, c, d,
GET(1), 0xa4beea44, 4)
224 STEP(
H, c, d,
a, b,
GET(7), 0xf6bb4b60, 16)
226 STEP(
H,
a, b, c, d,
GET(13), 0x289b7ec6, 4)
228 STEP(
H, c, d,
a, b,
GET(3), 0xd4ef3085, 16)
230 STEP(
H,
a, b, c, d,
GET(9), 0xd9d4d039, 4)
232 STEP(
H, c, d,
a, b,
GET(15), 0x1fa27cf8, 16)
236 STEP(
I,
a, b, c, d,
GET(0), 0xf4292244, 6)
237 STEP(
I, d,
a, b, c,
GET(7), 0x432aff97, 10)
238 STEP(
I, c, d,
a, b,
GET(14), 0xab9423a7, 15)
239 STEP(
I, b, c, d,
a,
GET(5), 0xfc93a039, 21)
240 STEP(
I,
a, b, c, d,
GET(12), 0x655b59c3, 6)
241 STEP(
I, d,
a, b, c,
GET(3), 0x8f0ccc92, 10)
242 STEP(
I, c, d,
a, b,
GET(10), 0xffeff47d, 15)
243 STEP(
I, b, c, d,
a,
GET(1), 0x85845dd1, 21)
244 STEP(
I,
a, b, c, d,
GET(8), 0x6fa87e4f, 6)
245 STEP(
I, d,
a, b, c,
GET(15), 0xfe2ce6e0, 10)
246 STEP(
I, c, d,
a, b,
GET(6), 0xa3014314, 15)
247 STEP(
I, b, c, d,
a,
GET(13), 0x4e0811a1, 21)
248 STEP(
I,
a, b, c, d,
GET(4), 0xf7537e82, 6)
249 STEP(
I, d,
a, b, c,
GET(11), 0xbd3af235, 10)
250 STEP(
I, c, d,
a, b,
GET(2), 0x2ad7d2bb, 15)
251 STEP(
I, b, c, d,
a,
GET(9), 0xeb86d391, 21)
259 }
while (size -= 64);
284 unsigned long used, available;
288 if ((ctx->
lo = (saved_lo + size) & 0x1fffffff) < saved_lo)
290 ctx->
hi += size >> 29;
292 used = saved_lo & 0x3f;
295 available = 64 -
used;
297 if (size < available) {
303 data = (
const unsigned char *)
data + available;
316#define OUT(dst, src) \
317 (dst)[0] = (unsigned char)(src); \
318 (dst)[1] = (unsigned char)((src) >> 8); \
319 (dst)[2] = (unsigned char)((src) >> 16); \
320 (dst)[3] = (unsigned char)((src) >> 24);
324 unsigned long used, available;
331 available = 64 -
used;
355 memset(ctx, 0,
sizeof(*ctx));
char data[hepevt_bytes_allocation_ATLAS]
#define STEP(f, a, b, c, d, x, t, s)
solar's public-domain MD5, wrapped for C++.
void digest(unsigned char *result)
MD5(const unsigned char *buffer, unsigned long len)
void uuid_digest(uuid_t &uuid) const
const void * body(const void *data, size_t size)
std::string hex_digest() const
void raw_digest(unsigned char *s) const
void update(const void *data, size_t size)
unsigned char m_digest[16]
holding In fact this class is here in order to allow STL container for all features This class is sho...