Lines Matching +full:- +full:a
2 * This an amalgamation of md5.c and md5.h into a single file
19 (section A.5) but excluding the rest of Appendix A. It does not include
27 2002-04-13 lpd Removed support for non-ANSI compilers; removed
30 1999-11-04 lpd Edited comments slightly for automatic TOC extraction.
31 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5);
34 1999-05-03 lpd Original version.
41 * This package supports both compile-time and run-time determination of CPU
43 * compiled to run only on little-endian CPUs; if ARCH_IS_BIG_ENDIAN is
44 * defined as non-zero, the code will be compiled to run only on big-endian
46 * run on either big- or little-endian CPUs, but will run slightly less
50 typedef unsigned char md5_byte_t; /* 8-bit byte */
51 typedef unsigned int md5_word_t; /* 32-bit word */
67 /* Append a string to the message. */
83 This software is provided 'as-is', without any express or implied
93 in a product, an acknowledgment in the product documentation would be
111 (section A.5) but excluding the rest of Appendix A. It does not include
119 2002-04-13 lpd Clarified derivation from RFC 1321; now handles byte order
122 2002-03-11 lpd Corrected argument list for main(), and added int return
124 2002-02-21 lpd Added missing #include <stdio.h> in test program.
125 2000-07-03 lpd Patched to eliminate warnings about "constant is
127 self-checking.
128 1999-11-04 lpd Edited comments slightly for automatic TOC extraction.
129 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5).
130 1999-05-03 lpd Original version.
137 #undef BYTE_ORDER /* 1 = big-endian, -1 = little-endian, 0 = unknown */
139 #define BYTE_ORDER (ARCH_IS_BIG_ENDIAN ? 1 : -1)
213 md5_word_t a = pms->abcd[0], b = pms->abcd[1], c = pms->abcd[2], local
214 d = pms->abcd[3];
217 /* Define storage only for big-endian CPUs. */
220 /* Define storage for little-endian or both types of CPUs. */
228 * Determine dynamically whether this is a big-endian or
229 * little-endian machine, since we can use a more efficient
234 if (*((const md5_byte_t *)&w)) /* dynamic little-endian */
236 #if BYTE_ORDER <= 0 /* little-endian */
239 * On little-endian machines, we can process properly aligned
242 if (!((data - (const md5_byte_t *)0) & 3)) {
243 /* data are properly aligned, a direct assignment is possible */
244 /* cast through a (void *) should avoid a compiler warning,
246 https://github.com/bel2125/civetweb/issues/94#issuecomment-98112861
257 else /* dynamic big-endian */
259 #if BYTE_ORDER >= 0 /* big-endian */
262 * On big-endian machines, we must arrange the bytes in the
281 #define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32 - (n))))
285 a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s). */
287 #define SET(a, b, c, d, k, s, Ti) \ argument
288 t = a + F(b, c, d) + X[k] + Ti; \
289 a = ROTATE_LEFT(t, s) + b
292 SET(a, b, c, d, 0, 7, T1);
293 SET(d, a, b, c, 1, 12, T2);
294 SET(c, d, a, b, 2, 17, T3);
295 SET(b, c, d, a, 3, 22, T4);
296 SET(a, b, c, d, 4, 7, T5);
297 SET(d, a, b, c, 5, 12, T6);
298 SET(c, d, a, b, 6, 17, T7);
299 SET(b, c, d, a, 7, 22, T8);
300 SET(a, b, c, d, 8, 7, T9);
301 SET(d, a, b, c, 9, 12, T10);
302 SET(c, d, a, b, 10, 17, T11);
303 SET(b, c, d, a, 11, 22, T12);
304 SET(a, b, c, d, 12, 7, T13);
305 SET(d, a, b, c, 13, 12, T14);
306 SET(c, d, a, b, 14, 17, T15);
307 SET(b, c, d, a, 15, 22, T16);
312 a = b + ((a + G(b,c,d) + X[k] + T[i]) <<< s). */
314 #define SET(a, b, c, d, k, s, Ti) \ argument
315 t = a + G(b, c, d) + X[k] + Ti; \
316 a = ROTATE_LEFT(t, s) + b
319 SET(a, b, c, d, 1, 5, T17);
320 SET(d, a, b, c, 6, 9, T18);
321 SET(c, d, a, b, 11, 14, T19);
322 SET(b, c, d, a, 0, 20, T20);
323 SET(a, b, c, d, 5, 5, T21);
324 SET(d, a, b, c, 10, 9, T22);
325 SET(c, d, a, b, 15, 14, T23);
326 SET(b, c, d, a, 4, 20, T24);
327 SET(a, b, c, d, 9, 5, T25);
328 SET(d, a, b, c, 14, 9, T26);
329 SET(c, d, a, b, 3, 14, T27);
330 SET(b, c, d, a, 8, 20, T28);
331 SET(a, b, c, d, 13, 5, T29);
332 SET(d, a, b, c, 2, 9, T30);
333 SET(c, d, a, b, 7, 14, T31);
334 SET(b, c, d, a, 12, 20, T32);
339 a = b + ((a + H(b,c,d) + X[k] + T[i]) <<< s). */
341 #define SET(a, b, c, d, k, s, Ti) \ argument
342 t = a + H(b, c, d) + X[k] + Ti; \
343 a = ROTATE_LEFT(t, s) + b
346 SET(a, b, c, d, 5, 4, T33);
347 SET(d, a, b, c, 8, 11, T34);
348 SET(c, d, a, b, 11, 16, T35);
349 SET(b, c, d, a, 14, 23, T36);
350 SET(a, b, c, d, 1, 4, T37);
351 SET(d, a, b, c, 4, 11, T38);
352 SET(c, d, a, b, 7, 16, T39);
353 SET(b, c, d, a, 10, 23, T40);
354 SET(a, b, c, d, 13, 4, T41);
355 SET(d, a, b, c, 0, 11, T42);
356 SET(c, d, a, b, 3, 16, T43);
357 SET(b, c, d, a, 6, 23, T44);
358 SET(a, b, c, d, 9, 4, T45);
359 SET(d, a, b, c, 12, 11, T46);
360 SET(c, d, a, b, 15, 16, T47);
361 SET(b, c, d, a, 2, 23, T48);
366 a = b + ((a + I(b,c,d) + X[k] + T[i]) <<< s). */
368 #define SET(a, b, c, d, k, s, Ti) \ argument
369 t = a + I(b, c, d) + X[k] + Ti; \
370 a = ROTATE_LEFT(t, s) + b
373 SET(a, b, c, d, 0, 6, T49);
374 SET(d, a, b, c, 7, 10, T50);
375 SET(c, d, a, b, 14, 15, T51);
376 SET(b, c, d, a, 5, 21, T52);
377 SET(a, b, c, d, 12, 6, T53);
378 SET(d, a, b, c, 3, 10, T54);
379 SET(c, d, a, b, 10, 15, T55);
380 SET(b, c, d, a, 1, 21, T56);
381 SET(a, b, c, d, 8, 6, T57);
382 SET(d, a, b, c, 15, 10, T58);
383 SET(c, d, a, b, 6, 15, T59);
384 SET(b, c, d, a, 13, 21, T60);
385 SET(a, b, c, d, 4, 6, T61);
386 SET(d, a, b, c, 11, 10, T62);
387 SET(c, d, a, b, 2, 15, T63);
388 SET(b, c, d, a, 9, 21, T64);
394 pms->abcd[0] += a;
395 pms->abcd[1] += b;
396 pms->abcd[2] += c;
397 pms->abcd[3] += d;
403 pms->count[0] = pms->count[1] = 0;
404 pms->abcd[0] = 0x67452301;
405 pms->abcd[1] = /*0xefcdab89*/ T_MASK ^ 0x10325476;
406 pms->abcd[2] = /*0x98badcfe*/ T_MASK ^ 0x67452301;
407 pms->abcd[3] = 0x10325476;
415 size_t offset = (pms->count[0] >> 3) & 63;
422 pms->count[1] += (md5_word_t)(nbytes >> 29);
423 pms->count[0] += nbits;
424 if (pms->count[0] < nbits)
425 pms->count[1]++;
429 size_t copy = (offset + nbytes > 64 ? 64 - offset : nbytes);
431 memcpy(pms->buf + offset, p, copy);
435 left -= copy;
436 md5_process(pms, pms->buf);
440 for (; left >= 64; p += 64, left -= 64)
443 /* Process a final partial block. */
445 memcpy(pms->buf, p, left);
461 data[i] = (md5_byte_t)(pms->count[i >> 2] >> ((i & 3) << 3));
463 md5_append(pms, pad, ((55 - (pms->count[0] >> 3)) & 63) + 1);
467 digest[i] = (md5_byte_t)(pms->abcd[i >> 2] >> ((i & 3) << 3));