| OLD | NEW |
| 1 /* | 1 /* |
| 2 * This code implements the MD5 message-digest algorithm. | 2 * This code implements the MD5 message-digest algorithm. |
| 3 * The algorithm is due to Ron Rivest. This code was | 3 * The algorithm is due to Ron Rivest. This code was |
| 4 * written by Colin Plumb in 1993, no copyright is claimed. | 4 * written by Colin Plumb in 1993, no copyright is claimed. |
| 5 * This code is in the public domain; do with it what you wish. | 5 * This code is in the public domain; do with it what you wish. |
| 6 * | 6 * |
| 7 * Equivalent code is available from RSA Data Security, Inc. | 7 * Equivalent code is available from RSA Data Security, Inc. |
| 8 * This code has been tested against that, and is equivalent, | 8 * This code has been tested against that, and is equivalent, |
| 9 * except that you don't need to include two pages of legalese | 9 * except that you don't need to include two pages of legalese |
| 10 * with every copy. | 10 * with every copy. |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 | 156 |
| 157 /* Append length in bits and transform */ | 157 /* Append length in bits and transform */ |
| 158 putu32(ctx->bits[0], ctx->in + 56); | 158 putu32(ctx->bits[0], ctx->in + 56); |
| 159 putu32(ctx->bits[1], ctx->in + 60); | 159 putu32(ctx->bits[1], ctx->in + 60); |
| 160 | 160 |
| 161 yasm_md5_transform (ctx->buf, ctx->in); | 161 yasm_md5_transform (ctx->buf, ctx->in); |
| 162 putu32(ctx->buf[0], digest); | 162 putu32(ctx->buf[0], digest); |
| 163 putu32(ctx->buf[1], digest + 4); | 163 putu32(ctx->buf[1], digest + 4); |
| 164 putu32(ctx->buf[2], digest + 8); | 164 putu32(ctx->buf[2], digest + 8); |
| 165 putu32(ctx->buf[3], digest + 12); | 165 putu32(ctx->buf[3], digest + 12); |
| 166 memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */ | 166 memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */ |
| 167 } | 167 } |
| 168 | 168 |
| 169 #ifndef ASM_MD5 | 169 #ifndef ASM_MD5 |
| 170 | 170 |
| 171 /* The four core functions - F1 is optimized somewhat */ | 171 /* The four core functions - F1 is optimized somewhat */ |
| 172 | 172 |
| 173 /* #define F1(x, y, z) (x & y | ~x & z) */ | 173 /* #define F1(x, y, z) (x & y | ~x & z) */ |
| 174 #define F1(x, y, z) (z ^ (x & (y ^ z))) | 174 #define F1(x, y, z) (z ^ (x & (y ^ z))) |
| 175 #define F2(x, y, z) F1(z, x, y) | 175 #define F2(x, y, z) F1(z, x, y) |
| 176 #define F3(x, y, z) (x ^ y ^ z) | 176 #define F3(x, y, z) (x ^ y ^ z) |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 yasm_md5_final (checksum, &context); | 301 yasm_md5_final (checksum, &context); |
| 302 for (i = 0; i < 16; i++) | 302 for (i = 0; i < 16; i++) |
| 303 { | 303 { |
| 304 printf ("%02x", (unsigned int) checksum[i]); | 304 printf ("%02x", (unsigned int) checksum[i]); |
| 305 } | 305 } |
| 306 printf ("\n"); | 306 printf ("\n"); |
| 307 } | 307 } |
| 308 return 0; | 308 return 0; |
| 309 } | 309 } |
| 310 #endif /* TEST */ | 310 #endif /* TEST */ |
| OLD | NEW |