MCPcopy Index your code
hub / github.com/RsyncProject/rsync / md5_update

Function md5_update

lib/md5.c:157–198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155#endif
156
157void md5_update(md_context *ctx, const uchar *input, uint32 length)
158{
159 uint32 left, fill;
160
161 if (!length)
162 return;
163
164 left = ctx->totalN & 0x3F;
165 fill = CSUM_CHUNK - left;
166
167 ctx->totalN += length;
168 ctx->totalN &= 0xFFFFFFFF;
169
170 if (ctx->totalN < length)
171 ctx->totalN2++;
172
173 if (left && length >= fill) {
174 memcpy(ctx->buffer + left, input, fill);
175 md5_process(ctx, ctx->buffer);
176 length -= fill;
177 input += fill;
178 left = 0;
179 }
180
181#ifdef USE_MD5_ASM /* { */
182 if (length >= CSUM_CHUNK) {
183 uint32 chunks = length / CSUM_CHUNK;
184 md5_process_asm(ctx, input, chunks);
185 length -= chunks * CSUM_CHUNK;
186 input += chunks * CSUM_CHUNK;
187 }
188#else /* } { */
189 while (length >= CSUM_CHUNK) {
190 md5_process(ctx, input);
191 length -= CSUM_CHUNK;
192 input += CSUM_CHUNK;
193 }
194#endif /* } */
195
196 if (length)
197 memcpy(ctx->buffer + left, input, length);
198}
199
200static const uchar md5_padding[CSUM_CHUNK] = { 0x80 };
201

Callers 6

get_checksum2Function · 0.85
file_checksumFunction · 0.85
sum_updateFunction · 0.85
md5_resultFunction · 0.85
get_md5Function · 0.85
mainFunction · 0.85

Calls 1

md5_processFunction · 0.85

Tested by

no test coverage detected