Replace chunk_hash() with output from chunk_mac()

The quality is way better, the calculation is a bit slower though.

The key is statically initialized to zero, which will be changed later
to prevent hash flooding.
This commit is contained in:
Tobias Brunner
2013-06-11 11:03:11 +02:00
parent 1255de5a20
commit d1953fe403
2 changed files with 32 additions and 76 deletions
+8
View File
@@ -301,12 +301,20 @@ bool chunk_printable(chunk_t chunk, chunk_t *sane, char replace);
/**
* Computes a 32 bit hash of the given chunk.
*
* @note This hash is only intended for hash tables not for cryptographic purposes.
*
* @param chunk data to hash
* @return hash value
*/
u_int32_t chunk_hash(chunk_t chunk);
/**
* Incremental version of chunk_hash. Use this to hash two or more chunks.
*
* @param chunk data to hash
* @param hash previous hash value
* @return hash value
*/
u_int32_t chunk_hash_inc(chunk_t chunk, u_int32_t hash);