* will fill a supplied 16-byte array with the digest.
*/
+#include <string.h>
+
typedef unsigned long word32;
typedef unsigned char byte;
t = 64 - (t & 0x3f); /* Space available in ctx->in (at least 1) */
if ((unsigned)t > len) {
- bcopy(buf, (byte *)ctx->in + 64 - (unsigned)t, len);
+ memcpy((byte *)ctx->in + 64 - (unsigned)t, buf, len);
return;
}
/* First chunk is an odd size */
- bcopy(buf,(byte *)ctx->in + 64 - (unsigned)t, (unsigned)t);
+ memcpy((byte *)ctx->in + 64 - (unsigned)t, buf, (unsigned)t);
byteSwap(ctx->in, 16);
MD5Transform(ctx->buf, ctx->in);
buf += (unsigned)t;
/* Process data in 64-byte chunks */
while (len >= 64) {
- bcopy(buf, ctx->in, 64);
+ memcpy(ctx->in, buf, 64);
byteSwap(ctx->in, 16);
MD5Transform(ctx->buf, ctx->in);
buf += 64;
}
/* Handle any remaining bytes of data. */
- bcopy(buf, ctx->in, len);
+ memcpy(ctx->in, buf, len);
}
/*
count = 56 - 1 - count;
if (count < 0) { /* Padding forces an extra block */
- bzero(p, count+8);
+ memset(p, 0, count+8);
byteSwap(ctx->in, 16);
MD5Transform(ctx->buf, ctx->in);
p = (byte *)ctx->in;
count = 56;
}
- bzero(p, count+8);
+ memset(p, 0, count+8);
byteSwap(ctx->in, 14);
/* Append length in bits and transform */
MD5Transform(ctx->buf, ctx->in);
byteSwap(ctx->buf, 4);
- bcopy(ctx->buf, digest, 16);
- bzero(ctx,sizeof(ctx));
+ memcpy(digest, ctx->buf, 16);
+ memset(ctx,0,sizeof(ctx));
}