xxHash 0.8.2
Extremely fast non-cryptographic hash function
Loading...
Searching...
No Matches
Data Structures | Typedefs | Functions
XXH64 family

Data Structures

struct  XXH64_canonical_t
 Canonical (big endian) representation of XXH64_hash_t. More...
 

Typedefs

typedef struct XXH64_state_s XXH64_state_t
 The opaque state struct for the XXH64 streaming API.
 

Functions

XXH64_hash_t XXH64 (XXH_NOESCAPE const void *input, size_t length, XXH64_hash_t seed)
 Calculates the 64-bit hash of input using xxHash64.
 
XXH64_state_tXXH64_createState (void)
 Allocates an XXH64_state_t.
 
XXH_errorcode XXH64_freeState (XXH64_state_t *statePtr)
 Frees an XXH64_state_t.
 
void XXH64_copyState (XXH_NOESCAPE XXH64_state_t *dst_state, const XXH64_state_t *src_state)
 Copies one XXH64_state_t to another.
 
XXH_errorcode XXH64_reset (XXH_NOESCAPE XXH64_state_t *statePtr, XXH64_hash_t seed)
 Resets an XXH64_state_t to begin a new hash.
 
XXH_errorcode XXH64_update (XXH_NOESCAPE XXH64_state_t *statePtr, XXH_NOESCAPE const void *input, size_t length)
 Consumes a block of input to an XXH64_state_t.
 
XXH64_hash_t XXH64_digest (XXH_NOESCAPE const XXH64_state_t *statePtr)
 Returns the calculated hash value from an XXH64_state_t.
 
void XXH64_canonicalFromHash (XXH_NOESCAPE XXH64_canonical_t *dst, XXH64_hash_t hash)
 Converts an XXH64_hash_t to a big endian XXH64_canonical_t.
 
XXH64_hash_t XXH64_hashFromCanonical (XXH_NOESCAPE const XXH64_canonical_t *src)
 Converts an XXH64_canonical_t to a native XXH64_hash_t.
 

Detailed Description

Contains functions used in the classic 64-bit xxHash algorithm.

Note
XXH3 provides competitive speed for both 32-bit and 64-bit systems, and offers true 64/128 bit hash results. It provides better speed for systems with vector processing capabilities.

Typedef Documentation

◆ XXH64_state_t

typedef struct XXH64_state_s XXH64_state_t

The opaque state struct for the XXH64 streaming API.

See also
XXH64_state_s for details.

Function Documentation

◆ XXH64()

XXH64_hash_t XXH64 ( XXH_NOESCAPE const void *  input,
size_t  length,
XXH64_hash_t  seed 
)

Calculates the 64-bit hash of input using xxHash64.

This function usually runs faster on 64-bit systems, but slower on 32-bit systems (see benchmark).

Parameters
inputThe block of data to be hashed, at least length bytes in size.
lengthThe length of input, in bytes.
seedThe 64-bit seed to alter the hash's output predictably.
Precondition
The memory between input and input + length must be valid, readable, contiguous memory. However, if length is 0, input may be NULL. In C++, this also must be TriviallyCopyable.
Returns
The calculated 64-bit hash.
See also
XXH32(), XXH3_64bits_withSeed(), XXH3_128bits_withSeed(), XXH128(): Direct equivalents for the other variants of xxHash.
XXH64_createState(), XXH64_update(), XXH64_digest(): Streaming version.

◆ XXH64_createState()

XXH64_state_t * XXH64_createState ( void  )

Allocates an XXH64_state_t.

Must be freed with XXH64_freeState().

Returns
An allocated XXH64_state_t on success, NULL on failure.

◆ XXH64_freeState()

XXH_errorcode XXH64_freeState ( XXH64_state_t statePtr)

Frees an XXH64_state_t.

Must be allocated with XXH64_createState().

Parameters
statePtrA pointer to an XXH64_state_t allocated with XXH64_createState().
Returns
XXH_OK.

◆ XXH64_copyState()

void XXH64_copyState ( XXH_NOESCAPE XXH64_state_t dst_state,
const XXH64_state_t src_state 
)

Copies one XXH64_state_t to another.

Parameters
dst_stateThe state to copy to.
src_stateThe state to copy from.
Precondition
dst_state and src_state must not be NULL and must not overlap.

◆ XXH64_reset()

XXH_errorcode XXH64_reset ( XXH_NOESCAPE XXH64_state_t statePtr,
XXH64_hash_t  seed 
)

Resets an XXH64_state_t to begin a new hash.

This function resets and seeds a state. Call it before XXH64_update().

Parameters
statePtrThe state struct to reset.
seedThe 64-bit seed to alter the hash result predictably.
Precondition
statePtr must not be NULL.
Returns
XXH_OK on success, XXH_ERROR on failure.

◆ XXH64_update()

XXH_errorcode XXH64_update ( XXH_NOESCAPE XXH64_state_t statePtr,
XXH_NOESCAPE const void *  input,
size_t  length 
)

Consumes a block of input to an XXH64_state_t.

Call this to incrementally consume blocks of data.

Parameters
statePtrThe state struct to update.
inputThe block of data to be hashed, at least length bytes in size.
lengthThe length of input, in bytes.
Precondition
statePtr must not be NULL.
The memory between input and input + length must be valid, readable, contiguous memory. However, if length is 0, input may be NULL. In C++, this also must be TriviallyCopyable.
Returns
XXH_OK on success, XXH_ERROR on failure.

◆ XXH64_digest()

XXH64_hash_t XXH64_digest ( XXH_NOESCAPE const XXH64_state_t statePtr)

Returns the calculated hash value from an XXH64_state_t.

Note
Calling XXH64_digest() will not affect statePtr, so you can update, digest, and update again.
Parameters
statePtrThe state struct to calculate the hash from.
Precondition
statePtr must not be NULL.
Returns
The calculated xxHash64 value from that state.

◆ XXH64_canonicalFromHash()

void XXH64_canonicalFromHash ( XXH_NOESCAPE XXH64_canonical_t dst,
XXH64_hash_t  hash 
)

Converts an XXH64_hash_t to a big endian XXH64_canonical_t.

Parameters
dstThe XXH64_canonical_t pointer to be stored to.
hashThe XXH64_hash_t to be converted.
Precondition
dst must not be NULL.

◆ XXH64_hashFromCanonical()

XXH64_hash_t XXH64_hashFromCanonical ( XXH_NOESCAPE const XXH64_canonical_t src)

Converts an XXH64_canonical_t to a native XXH64_hash_t.

Parameters
srcThe XXH64_canonical_t to convert.
Precondition
src must not be NULL.
Returns
The converted hash.