- Timestamp:
- 2008-01-17T22:06:55Z (17 years ago)
- Branches:
- master
- Children:
- ac4adf9
- Parents:
- 13857c6
- Location:
- lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/md5.c
r13857c6 r52744f8 26 26 #include "md5.h" 27 27 28 static void md5_transform(u _int32_t buf[4], u_int32_t const in[16]);28 static void md5_transform(uint32_t buf[4], uint32_t const in[16]); 29 29 30 30 /* … … 53 53 unsigned int len) 54 54 { 55 u _int32_t t;55 uint32_t t; 56 56 57 57 /* Update bitcount */ 58 58 59 59 t = ctx->bits[0]; 60 if ((ctx->bits[0] = t + ((u _int32_t) len << 3)) < t)60 if ((ctx->bits[0] = t + ((uint32_t) len << 3)) < t) 61 61 ctx->bits[1]++; /* Carry from low to high */ 62 62 ctx->bits[1] += len >> 29; … … 75 75 } 76 76 memcpy(p, buf, t); 77 md5_transform(ctx->buf, (u _int32_t *) ctx->in);77 md5_transform(ctx->buf, (uint32_t *) ctx->in); 78 78 buf += t; 79 79 len -= t; … … 83 83 while (len >= 64) { 84 84 memcpy(ctx->in, buf, 64); 85 md5_transform(ctx->buf, (u _int32_t *) ctx->in);85 md5_transform(ctx->buf, (uint32_t *) ctx->in); 86 86 buf += 64; 87 87 len -= 64; … … 117 117 /* Two lots of padding: Pad the first block to 64 bytes */ 118 118 memset(p, 0, count); 119 md5_transform(ctx->buf, (u _int32_t *) ctx->in);119 md5_transform(ctx->buf, (uint32_t *) ctx->in); 120 120 121 121 /* Now fill the next block with 56 bytes */ … … 127 127 128 128 /* Append length in bits and transform */ 129 ((u _int32_t *) ctx->in)[14] = ctx->bits[0];130 ((u _int32_t *) ctx->in)[15] = ctx->bits[1];131 132 md5_transform(ctx->buf, (u _int32_t *) ctx->in);129 ((uint32_t *) ctx->in)[14] = ctx->bits[0]; 130 ((uint32_t *) ctx->in)[15] = ctx->bits[1]; 131 132 md5_transform(ctx->buf, (uint32_t *) ctx->in); 133 133 memcpy(digest, ctx->buf, 16); 134 134 memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */ … … 152 152 * the data and converts bytes into longwords for this routine. 153 153 */ 154 static void md5_transform(u _int32_t buf[4], u_int32_t const in[16])155 { 156 register u _int32_t a, b, c, d;154 static void md5_transform(uint32_t buf[4], uint32_t const in[16]) 155 { 156 register uint32_t a, b, c, d; 157 157 158 158 a = buf[0]; -
lib/md5.h
r13857c6 r52744f8 27 27 #include <sys/types.h> 28 28 #include <gmodule.h> 29 #include <stdint.h> 29 30 30 typedef u _int8_t md5_byte_t;31 typedef uint8_t md5_byte_t; 31 32 typedef struct MD5Context { 32 u _int32_t buf[4];33 u _int32_t bits[2];33 uint32_t buf[4]; 34 uint32_t bits[2]; 34 35 unsigned char in[64]; 35 36 } md5_state_t;
Note: See TracChangeset
for help on using the changeset viewer.