MCPcopy Create free account
hub / github.com/OpenDDS/OpenDDS / MD5_Update

Function MD5_Update

dds/DCPS/Hash.cpp:233–265  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

231}
232
233void MD5_Update(MD5_CTX *ctx, const void *data, unsigned long size)
234{
235 MD5_u32plus saved_lo;
236 unsigned long used;
237
238 saved_lo = ctx->lo;
239 if ((ctx->lo = (saved_lo + size) & 0x1fffffff) < saved_lo)
240 ctx->hi++;
241 ctx->hi += size >> 29;
242
243 used = saved_lo & 0x3f;
244
245 if (used) {
246 unsigned long free = 64 - used;
247
248 if (size < free) {
249 memcpy(&ctx->buffer[used], data, size);
250 return;
251 }
252
253 memcpy(&ctx->buffer[used], data, free);
254 data = (const unsigned char *)data + free;
255 size -= free;
256 body(ctx, ctx->buffer, 64);
257 }
258
259 if (size >= 64) {
260 data = body(ctx, data, size & ~(unsigned long)0x3f);
261 size &= 0x3f;
262 }
263
264 memcpy(ctx->buffer, data, size);
265}
266
267void MD5_Final(unsigned char *result, MD5_CTX *ctx)
268{

Callers 1

MD5HashFunction · 0.85

Calls 1

bodyFunction · 0.85

Tested by

no test coverage detected