void RMD160Update(RMD160_CTX *ctx, const u_char *input, u_int32_t len) { u_int32_t have, off, need; have = (ctx->count/8) % 64; need = 64 - have; ctx->count += 8 * len; off = 0; if (len >= need) { if (have) { memcpy(ctx->buffer + have, input, need); RMD160Transform(ctx->state, ctx->buffer); off = need; have = 0; } /* now the buffer is empty */ while (off + 64 <= len) { RMD160Transform(ctx->state, input+off); off += 64; } } if (off < len) memcpy(ctx->buffer + have, input+off, len-off); }
void RMD160Update(RMD160_CTX *ctx, const u_int8_t *input, size_t len) { size_t have, off, need; have = (ctx->count / 8) % RMD160_BLOCK_LENGTH; need = RMD160_BLOCK_LENGTH - have; ctx->count += 8 * len; off = 0; if (len >= need) { if (have) { memcpy(ctx->buffer + have, input, need); RMD160Transform(ctx->state, ctx->buffer); off = need; have = 0; } /* now the buffer is empty */ while (off + RMD160_BLOCK_LENGTH <= len) { RMD160Transform(ctx->state, input+off); off += RMD160_BLOCK_LENGTH; } } if (off < len) memcpy(ctx->buffer + have, input+off, len-off); }
void RMD160Update(RMD160CTX* context, const uint8_t* input, size_t length) { uint32_t have, off, need; have = (context->count / 8) % RMD160_BLOCK_LENGTH; need = RMD160_BLOCK_LENGTH - have; context->count += 8 * length; off = 0; if (length >= need) { if (have) { memcpy(context->buffer + have, input, need); RMD160Transform(context->state, context->buffer); off = need; have = 0; } while (off + RMD160_BLOCK_LENGTH <= length) { RMD160Transform(context->state, input + off); off += RMD160_BLOCK_LENGTH; } } if (off < length) { memcpy(context->buffer + have, input + off, length - off); } }