2024年3月12日发(作者:)

uint32 t;

do {

t = (uint32) ((unsigned) buf[3] << 8 | buf[2]) << 16 |((unsigned) buf[1] << 8 | buf[0]);

*(uint32 *) buf = t;

buf += 4;

} while (--longs);

}

#endif

void MD5Init(ctx)struct MD5Context *ctx;

{

ctx->buf[0] = 0x67452301;

ctx->buf[1] = 0xefcdab89;

ctx->buf[2] = 0x98badcfe;

ctx->buf[3] = 0x10325476;

ctx->bits[0] = 0;

ctx->bits[1] = 0;

}

void MD5Update(ctx, buf, len) struct MD5Context *ctx; unsigned char *buf; unsigned len;

{

uint32 t;

t = ctx->bits[0];

if ((ctx->bits[0] = t + ((uint32) len << 3)) < t)

ctx->bits[1]++;

ctx->bits[1] += len >> 29;

t = (t >> 3) & 0x3f;

if (t) {

unsigned char *p = (unsigned char *) ctx->in + t;

t = 64 - t;

if (len < t) {

memcpy(p, buf, len);

return;

}

memcpy(p, buf, t);

byteReverse(ctx->in, 16);