Use AFL hash32

This commit is contained in:
mio
2025-01-26 15:46:25 +08:00
parent c7c66bd0d6
commit 604cf2cf80
3 changed files with 4 additions and 20 deletions

View File

@ -33,8 +33,6 @@
u32 hash32(u8 *key, u32 len, u32 seed);
u64 hash64(u8 *key, u32 len, u64 seed);
u32 hash32_xxh32(u8 *key, u32 len, u32 seed);
#if 0
The following code is disabled because xxh3 is 30% faster

View File

@ -542,9 +542,8 @@ u8 __attribute__((hot)) save_if_interesting(afl_state_t *afl, void *mem,
afl->fsrv.map_size);
simplify_trace(afl, afl->san_fsrvs[0].trace_bits);
// cksum_simplified = hash64(afl->san_fsrvs[0].trace_bits,
// afl->fsrv.map_size, HASH_CONST);
cksum_simplified = hash32_xxh32(afl->san_fsrvs[0].trace_bits,
// Note: Original SAND implementation used XXHASH32
cksum_simplified = hash32(afl->san_fsrvs[0].trace_bits,
afl->fsrv.map_size, HASH_CONST);
if (unlikely(!bitmap_read(afl->simplified_n_fuzz, cksum_simplified))) {
@ -570,7 +569,7 @@ u8 __attribute__((hot)) save_if_interesting(afl_state_t *afl, void *mem,
likely(afl->san_abstraction == UNIQUE_TRACE)) {
cksum_unique =
hash32_xxh32(afl->fsrv.trace_bits, afl->fsrv.map_size, HASH_CONST);
hash32(afl->fsrv.trace_bits, afl->fsrv.map_size, HASH_CONST);
if (unlikely(!bitmap_read(afl->n_fuzz_dup, cksum) &&
fault == afl->crash_mode)) {

View File

@ -424,16 +424,3 @@ char *sha1_hex_for_file(const char *fname, u32 len) {
return hex;
}
#ifdef _DEBUG
u32 hash32_xxh32(u8 *key, u32 len, u32 seed) {
#else
inline u32 hash32_xxh32(u8 *key, u32 len, u32 seed) {
#endif
(void)seed;
return (u32)XXH32(key, len, seed);
}