Pyrogenesis  trunk
Functions
fnv_hash.cpp File Reference
#include "precompiled.h"
#include "lib/fnv_hash.h"
Include dependency graph for fnv_hash.cpp:

Functions

u32 fnv_hash (const void *buf, size_t len)
 rationale: this algorithm was chosen because it delivers 'good' results for string data and is relatively simple. More...
 
u64 fnv_hash64 (const void *buf, size_t len)
 64-bit version of fnv_hash. More...
 

Function Documentation

◆ fnv_hash()

u32 fnv_hash ( const void *  buf,
size_t  len = 0 
)

rationale: this algorithm was chosen because it delivers 'good' results for string data and is relatively simple.

other good alternatives exist; see Ozan Yigit's hash roundup. calculate FNV1-A hash.

Parameters
bufinput buffer.
lenif 0 (default), treat buf as a C-string; otherwise, indicates how many bytes of buffer to hash.
Returns
hash result. note: results are distinct for buffers containing differing amounts of zero bytes because the hash value is seeded.

◆ fnv_hash64()

u64 fnv_hash64 ( const void *  buf,
size_t  len 
)

64-bit version of fnv_hash.