28#include "librsync_export.h"
30LIBRSYNC_EXPORT
const int RS_MD4_SUM_LENGTH = 16;
31LIBRSYNC_EXPORT
const int RS_BLAKE2_SUM_LENGTH = 32;
36 if (kind == RS_ROLLSUM) {
39 RollsumUpdate(&sum, buf, len);
40 return RollsumDigest(&sum);
44 rabinkarp_update(&sum, buf, len);
45 return rabinkarp_digest(&sum);
63 rs_mdfour((
unsigned char *)sum, buf, len);
66 blake2b_init(&ctx, RS_MAX_STRONG_SUM_LENGTH);
67 blake2b_update(&ctx, (
const uint8_t *)buf, len);
68 blake2b_final(&ctx, (uint8_t *)sum, RS_MAX_STRONG_SUM_LENGTH);
Abstract wrappers around different weaksum and strongsum implementations.
rs_weak_sum_t rs_calc_weak_sum(weaksum_kind_t kind, void const *buf, size_t len)
Calculate a weaksum.
strongsum_kind_t
Strongsum implementations.
weaksum_kind_t
Weaksum implementations.
void rs_calc_strong_sum(strongsum_kind_t kind, void const *buf, size_t len, rs_strong_sum_t *sum)
Calculate a strongsum.
The rabinkarp_t state type.
The rs_mdfour state type.