fix collisions for xxh128 in 9-16 bytes range
This commit is contained in:
Yann Collet 2019-09-27 17:55:33 -07:00
parent 3649220147
commit e098fffe0a
5 changed files with 7 additions and 7 deletions

View File

@ -254,8 +254,8 @@ namespaceTest: ## ensure XXH_NAMESPACE redefines all public symbols
MD2ROFF ?= ronn
MD2ROFF_FLAGS ?= --roff --warnings --manual="User Commands" --organization="xxhsum $(XXHSUM_VERSION)"
xxhsum.1: xxhsum.1.md
cat $^ | $(MD2ROFF) $(MD2ROFF_FLAGS) | sed -n '/^\.\\\".*/!p' > $@
xxhsum.1: xxhsum.1.md xxhash.h
cat $< | $(MD2ROFF) $(MD2ROFF_FLAGS) | sed -n '/^\.\\\".*/!p' > $@
.PHONY: man
man: xxhsum.1 ## generate man page from markdown source

2
xxh3.h
View File

@ -1336,7 +1336,7 @@ XXH3_len_9to16_128b(const void* data, size_t len, const void* keyPtr, XXH64_hash
U64 const ll2 = XXH_readLE64((const BYTE*)data + len - 8) ^ (XXH_readLE64(key64+1) - seed);
U64 const inlow = ll1 ^ ll2;
XXH128_hash_t m128 = XXH_mult64to128(inlow, PRIME64_1);
//U64 const lenContrib = (U64)(U32)len * (U64)PRIME32_5; m128.low64 += lenContrib;
U64 const lenContrib = (U64)(U32)len * (U64)PRIME32_5; m128.low64 += lenContrib;
m128.high64 += ll2 * PRIME64_1;
m128.low64 ^= (m128.high64 >> 32);
{ XXH128_hash_t h128 = XXH_mult64to128(m128.low64, PRIME64_2);

View File

@ -164,7 +164,7 @@ typedef enum { XXH_OK=0, XXH_ERROR } XXH_errorcode;
***************************************/
#define XXH_VERSION_MAJOR 0
#define XXH_VERSION_MINOR 7
#define XXH_VERSION_RELEASE 1
#define XXH_VERSION_RELEASE 2
#define XXH_VERSION_NUMBER (XXH_VERSION_MAJOR *100*100 + XXH_VERSION_MINOR *100 + XXH_VERSION_RELEASE)
XXH_PUBLIC_API unsigned XXH_versionNumber (void);

View File

@ -1,5 +1,5 @@
.
.TH "XXHSUM" "1" "July 2019" "xxhsum 0.7.1" "User Commands"
.TH "XXHSUM" "1" "September 2019" "xxhsum 0.7.2" "User Commands"
.
.SH "NAME"
\fBxxhsum\fR \- print or check xxHash non\-cryptographic checksums

View File

@ -814,10 +814,10 @@ static void BMK_sanityCheck(void)
{ XXH128_hash_t const expected = { 0x97B28D3079F8541FULL, 0xEFC0B954298E6555ULL };
BMK_testXXH128(sanityBuffer, 6, prime, expected); /* 4-8 */
}
{ XXH128_hash_t const expected = { 0x0E0CD01F05AC2F0DULL, 0x2B55C95951070D4BULL };
{ XXH128_hash_t const expected = { 0x9044570967199F91ULL, 0x738EE3E642A85165ULL };
BMK_testXXH128(sanityBuffer, 12, 0, expected); /* 9-16 */
}
{ XXH128_hash_t const expected = { 0xA9DE561CA04CDF37ULL, 0x609E31FDC00A43C9ULL };
{ XXH128_hash_t const expected = { 0xE3C75A78FE67D411ULL, 0xD4396DA60355312BULL };
BMK_testXXH128(sanityBuffer, 12, prime, expected); /* 9-16 */
}
{ XXH128_hash_t const expected = { 0x46796F3F78B20F6BULL, 0x58FF55C3926C13FAULL };