| 180 | } |
| 181 | |
| 182 | void md5_update( md5_context *ctx, uint8 *input, uint32 length ) |
| 183 | { |
| 184 | uint32 left, fill; |
| 185 | |
| 186 | if (!length) return; |
| 187 | |
| 188 | left = ctx->total[0] & 0x3F; |
| 189 | fill = 64 - left; |
| 190 | |
| 191 | ctx->total[0] += length; |
| 192 | ctx->total[0] &= 0xFFFFFFFF; |
| 193 | |
| 194 | if (ctx->total[0] < length) |
| 195 | ctx->total[1]++; |
| 196 | |
| 197 | if (left && length >= fill) |
| 198 | { |
| 199 | memcpy( (void *)(ctx->buffer + left), |
| 200 | (void *)input, fill ); |
| 201 | md5_process( ctx, ctx->buffer ); |
| 202 | length -= fill; |
| 203 | input += fill; |
| 204 | left = 0; |
| 205 | } |
| 206 | |
| 207 | while (length >= 64) |
| 208 | { |
| 209 | md5_process( ctx, input ); |
| 210 | length -= 64; |
| 211 | input += 64; |
| 212 | } |
| 213 | |
| 214 | if (length) |
| 215 | { |
| 216 | memcpy( (void *)(ctx->buffer + left), |
| 217 | (void *)input, length ); |
| 218 | } |
| 219 | } |
| 220 | |
| 221 | static uint8 md5_padding[64] = |
| 222 | { |
no test coverage detected