diff options
Diffstat (limited to 'src/lib/util/md5.c')
-rw-r--r-- | src/lib/util/md5.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/lib/util/md5.c b/src/lib/util/md5.c index ba1406f6358..55ca7c70c1f 100644 --- a/src/lib/util/md5.c +++ b/src/lib/util/md5.c @@ -20,7 +20,7 @@ * Still in the public domain. */ -#include <string.h> /* for memcpy() */ +#include <string.h> /* for memcpy() */ #include "md5.h" @@ -69,9 +69,9 @@ MD5Update(struct MD5Context *ctx, md5byte const *buf, unsigned len) t = ctx->bytes[0]; if ((ctx->bytes[0] = t + len) < t) - ctx->bytes[1]++; /* Carry from low to high */ + ctx->bytes[1]++; /* Carry from low to high */ - t = 64 - (t & 0x3f); /* Space available in ctx->in (at least 1) */ + t = 64 - (t & 0x3f); /* Space available in ctx->in (at least 1) */ if (t > len) { memcpy((md5byte *)ctx->in + 64 - t, buf, len); return; @@ -103,7 +103,7 @@ MD5Update(struct MD5Context *ctx, md5byte const *buf, unsigned len) void MD5Final(md5byte digest[16], struct MD5Context *ctx) { - int count = ctx->bytes[0] & 0x3f; /* Number of bytes in ctx->in */ + int count = ctx->bytes[0] & 0x3f; /* Number of bytes in ctx->in */ md5byte *p = (md5byte *)ctx->in + count; /* Set the first char of padding to 0x80. There is always room. */ @@ -112,7 +112,7 @@ MD5Final(md5byte digest[16], struct MD5Context *ctx) /* Bytes of padding needed to make 56 bytes (-8..55) */ count = 56 - 1 - count; - if (count < 0) { /* Padding forces an extra block */ + if (count < 0) { /* Padding forces an extra block */ memset(p, 0, count + 8); byteSwap(ctx->in, 16); MD5Transform(ctx->buf, ctx->in); @@ -129,7 +129,7 @@ MD5Final(md5byte digest[16], struct MD5Context *ctx) byteSwap(ctx->buf, 4); memcpy(digest, ctx->buf, 16); - memset(ctx, 0, sizeof(MD5Context)); /* In case it's sensitive */ + memset(ctx, 0, sizeof(MD5Context)); /* In case it's sensitive */ } #ifndef ASM_MD5 @@ -144,7 +144,7 @@ MD5Final(md5byte digest[16], struct MD5Context *ctx) /* This is the central step in the MD5 algorithm. */ #define MD5STEP(f,w,x,y,z,in,s) \ - (w += f(x,y,z) + in, w = (w<<s | w>>(32-s)) + x) + (w += f(x,y,z) + in, w = (w<<s | w>>(32-s)) + x) /* * The core of the MD5 algorithm, this alters an existing MD5 hash to @@ -236,4 +236,3 @@ MD5Transform(UWORD32 buf[4], UWORD32 const in[16]) } #endif - |