58 #define SHIFT(X, s) (((X) << (s)) | ((X) >> (32 - (s))))
60 #define F(X, Y, Z) (((X) & (Y)) | ((~X) & (Z)))
61 #define G(X, Y, Z) (((X) & (Z)) | ((Y) & (~Z)))
62 #define H(X, Y, Z) ((X) ^ (Y) ^ (Z))
63 #define I(X, Y, Z) ((Y) ^ ((X) | (~Z)))
65 #define ROUND1(a, b, c, d, k, s, i) \
67 (a) = (a) + F((b), (c), (d)) + X[(k)] + T[(i)]; \
68 (a) = SHIFT((a), (s)); \
72 #define ROUND2(a, b, c, d, k, s, i) \
74 (a) = (a) + G((b), (c), (d)) + X[(k)] + T[(i)]; \
75 (a) = SHIFT((a), (s)); \
79 #define ROUND3(a, b, c, d, k, s, i) \
81 (a) = (a) + H((b), (c), (d)) + X[(k)] + T[(i)]; \
82 (a) = SHIFT((a), (s)); \
86 #define ROUND4(a, b, c, d, k, s, i) \
88 (a) = (a) + I((b), (c), (d)) + X[(k)] + T[(i)]; \
89 (a) = SHIFT((a), (s)); \
113 #define MD5_A0 0x67452301
114 #define MD5_B0 0xefcdab89
115 #define MD5_C0 0x98badcfe
116 #define MD5_D0 0x10325476
121 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee,
122 0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501,
123 0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be,
124 0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821,
126 0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa,
127 0xd62f105d, 0x2441453, 0xd8a1e681, 0xe7d3fbc8,
128 0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed,
129 0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a,
131 0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c,
132 0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70,
133 0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x4881d05,
134 0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665,
136 0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039,
137 0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1,
138 0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1,
139 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391,
143 0x80, 0, 0, 0, 0, 0, 0, 0,
144 0, 0, 0, 0, 0, 0, 0, 0,
145 0, 0, 0, 0, 0, 0, 0, 0,
146 0, 0, 0, 0, 0, 0, 0, 0,
147 0, 0, 0, 0, 0, 0, 0, 0,
148 0, 0, 0, 0, 0, 0, 0, 0,
149 0, 0, 0, 0, 0, 0, 0, 0,
150 0, 0, 0, 0, 0, 0, 0, 0,
161 #ifndef WORDS_BIGENDIAN
319 gap -
sizeof(ctx->md5_n));
331 #ifndef WORDS_BIGENDIAN
332 memmove(&ctx->
md5_buf[56], &ctx->md5_n8[0], 8);
334 ctx->
md5_buf[56] = ctx->md5_n8[7];
335 ctx->
md5_buf[57] = ctx->md5_n8[6];
336 ctx->
md5_buf[58] = ctx->md5_n8[5];
337 ctx->
md5_buf[59] = ctx->md5_n8[4];
338 ctx->
md5_buf[60] = ctx->md5_n8[3];
339 ctx->
md5_buf[61] = ctx->md5_n8[2];
340 ctx->
md5_buf[62] = ctx->md5_n8[1];
341 ctx->
md5_buf[63] = ctx->md5_n8[0];
351 #ifndef WORDS_BIGENDIAN
352 memmove(digest, &ctx->md5_st8[0], 16);
354 digest[0] = ctx->md5_st8[3];
355 digest[1] = ctx->md5_st8[2];
356 digest[2] = ctx->md5_st8[1];
357 digest[3] = ctx->md5_st8[0];
358 digest[4] = ctx->md5_st8[7];
359 digest[5] = ctx->md5_st8[6];
360 digest[6] = ctx->md5_st8[5];
361 digest[7] = ctx->md5_st8[4];
362 digest[8] = ctx->md5_st8[11];
363 digest[9] = ctx->md5_st8[10];
364 digest[10] = ctx->md5_st8[9];
365 digest[11] = ctx->md5_st8[8];
366 digest[12] = ctx->md5_st8[15];
367 digest[13] = ctx->md5_st8[14];
368 digest[14] = ctx->md5_st8[13];
369 digest[15] = ctx->md5_st8[12];
405 ctx->md5_n +=
len * 8;
#define ROUND2(a, b, c, d, k, s, i)
static void md5_result(uint8 *digest, pg_md5_ctx *ctx)
void pg_md5_init(pg_md5_ctx *ctx)
void pg_md5_update(pg_md5_ctx *ctx, const uint8 *data, size_t len)
#define ROUND3(a, b, c, d, k, s, i)
void pg_md5_final(pg_md5_ctx *ctx, uint8 *dest)
#define ROUND1(a, b, c, d, k, s, i)
static const uint8 md5_paddat[MD5_BUFLEN]
#define ROUND4(a, b, c, d, k, s, i)
static void md5_pad(pg_md5_ctx *ctx)
static const uint32 T[65]
static void md5_calc(const uint8 *b64, pg_md5_ctx *ctx)
uint8 md5_buf[MD5_BUFLEN]