diff options
author | Wayne Davison <wayne@opencoder.net> | 2020-05-28 12:05:54 -0700 |
---|---|---|
committer | Wayne Davison <wayne@opencoder.net> | 2020-05-28 12:33:36 -0700 |
commit | d7521f54282fe7dc7c259a52624a0ac75ccb8f11 (patch) | |
tree | b1ad9977ac646e160b0e9b20aeec79d4ae1f67ce /checksum.c | |
parent | c7f10de4426375fc721ecd815ceddae7766c6598 (diff) | |
download | rsync-d7521f54282fe7dc7c259a52624a0ac75ccb8f11.tar.gz |
The xxh* checksums don't need to be reversed on output.
Diffstat (limited to 'checksum.c')
-rw-r--r-- | checksum.c | 22 |
1 files changed, 21 insertions, 1 deletions
@@ -162,9 +162,29 @@ int csum_len_for_type(int cst, BOOL flist_csum) return 0; } +/* Returns 0 if the checksum is not canonical (i.e. it includes a seed value). + * Returns 1 if the public sum order matches our internal sum order. + * Returns -1 if the public sum order is the reverse of our internal sum order. + */ int canonical_checksum(int csum_type) { - return csum_type >= CSUM_MD4 ? 1 : 0; + switch (csum_type) { + case CSUM_NONE: + case CSUM_MD4_ARCHAIC: + case CSUM_MD4_OLD: + case CSUM_MD4_BUSTED: + break; + case CSUM_MD4: + case CSUM_MD5: + return -1; +#ifdef SUPPORT_XXHASH + case CSUM_XXH64: + return 1; +#endif + default: /* paranoia to prevent missing case values */ + exit_cleanup(RERR_UNSUPPORTED); + } + return 0; } #ifndef HAVE_SIMD /* See simd-checksum-*.cpp. */ |