Data Structures | |
| struct | XXH32_canonical_t |
| Canonical (big endian) representation of XXH32_hash_t. More... | |
Typedefs | |
| typedef struct XXH32_state_s | XXH32_state_t |
| The opaque state struct for the XXH32 streaming API. | |
Functions | |
| XXH32_hash_t | XXH32 (const void *input, size_t length, XXH32_hash_t seed) |
Calculates the 32-bit hash of input using xxHash32. | |
| XXH32_state_t * | XXH32_createState (void) |
| Allocates an XXH32_state_t. | |
| XXH_errorcode | XXH32_freeState (XXH32_state_t *statePtr) |
| Frees an XXH32_state_t. | |
| void | XXH32_copyState (XXH32_state_t *dst_state, const XXH32_state_t *src_state) |
| Copies one XXH32_state_t to another. | |
| XXH_errorcode | XXH32_reset (XXH32_state_t *statePtr, XXH32_hash_t seed) |
| Resets an XXH32_state_t to begin a new hash. | |
| XXH_errorcode | XXH32_update (XXH32_state_t *statePtr, const void *input, size_t length) |
Consumes a block of input to an XXH32_state_t. | |
| XXH32_hash_t | XXH32_digest (const XXH32_state_t *statePtr) |
| Returns the calculated hash value from an XXH32_state_t. | |
| void | XXH32_canonicalFromHash (XXH32_canonical_t *dst, XXH32_hash_t hash) |
| Converts an XXH32_hash_t to a big endian XXH32_canonical_t. | |
| XXH32_hash_t | XXH32_hashFromCanonical (const XXH32_canonical_t *src) |
| Converts an XXH32_canonical_t to a native XXH32_hash_t. | |
Detailed Description
Contains functions used in the classic 32-bit xxHash algorithm.
- Note
- XXH32 is useful for older platforms, with no or poor 64-bit performance. Note that the XXH3 family provides competitive speed for both 32-bit and 64-bit systems, and offers true 64/128 bit hash results.
- See also
- XXH64 family, XXH3 family : Other xxHash families
- XXH32 implementation for implementation details
Typedef Documentation
◆ XXH32_state_t
| typedef struct XXH32_state_s XXH32_state_t |
The opaque state struct for the XXH32 streaming API.
- See also
- XXH32_state_s for details.
- Streaming Example
Function Documentation
◆ XXH32()
| XXH32_hash_t XXH32 | ( | const void * | input, |
| size_t | length, | ||
| XXH32_hash_t | seed ) |
Calculates the 32-bit hash of input using xxHash32.
- Parameters
-
input The block of data to be hashed, at least lengthbytes in size.length The length of input, in bytes.seed The 32-bit seed to alter the hash's output predictably.
- Precondition
- The memory between
inputandinput+lengthmust be valid, readable, contiguous memory. However, iflengthis 0,inputmay be NULL. In C++, this also must be TriviallyCopyable.
- Returns
- The calculated 32-bit xxHash32 value.
- See also
- Single Shot Example for an example.
◆ XXH32_createState()
| XXH32_state_t * XXH32_createState | ( | void | ) |
Allocates an XXH32_state_t.
- Returns
- An allocated pointer of XXH32_state_t on success.
- NULL on failure.
- Note
- Must be freed with XXH32_freeState().
- See also
- Streaming Example
◆ XXH32_freeState()
| XXH_errorcode XXH32_freeState | ( | XXH32_state_t * | statePtr | ) |
Frees an XXH32_state_t.
- Parameters
-
statePtr A pointer to an XXH32_state_t allocated with XXH32_createState().
- Returns
- XXH_OK.
- Note
statePtrmust be allocated with XXH32_createState().
- See also
- Streaming Example
◆ XXH32_copyState()
| void XXH32_copyState | ( | XXH32_state_t * | dst_state, |
| const XXH32_state_t * | src_state ) |
Copies one XXH32_state_t to another.
- Parameters
-
dst_state The state to copy to. src_state The state to copy from.
- Precondition
dst_stateandsrc_statemust not be NULL and must not overlap.
◆ XXH32_reset()
| XXH_errorcode XXH32_reset | ( | XXH32_state_t * | statePtr, |
| XXH32_hash_t | seed ) |
Resets an XXH32_state_t to begin a new hash.
- Parameters
-
statePtr The state struct to reset. seed The 32-bit seed to alter the hash result predictably.
- Precondition
statePtrmust not be NULL.
- Note
- This function resets and seeds a state. Call it before XXH32_update().
- See also
- Streaming Example
◆ XXH32_update()
| XXH_errorcode XXH32_update | ( | XXH32_state_t * | statePtr, |
| const void * | input, | ||
| size_t | length ) |
Consumes a block of input to an XXH32_state_t.
- Parameters
-
statePtr The state struct to update. input The block of data to be hashed, at least lengthbytes in size.length The length of input, in bytes.
- Precondition
statePtrmust not be NULL.-
The memory between
inputandinput+lengthmust be valid, readable, contiguous memory. However, iflengthis 0,inputmay be NULL. In C++, this also must be TriviallyCopyable.
- Note
- Call this to incrementally consume blocks of data.
- See also
- Streaming Example
◆ XXH32_digest()
| XXH32_hash_t XXH32_digest | ( | const XXH32_state_t * | statePtr | ) |
Returns the calculated hash value from an XXH32_state_t.
- Parameters
-
statePtr The state struct to calculate the hash from.
- Precondition
statePtrmust not be NULL.
- Returns
- The calculated 32-bit xxHash32 value from that state.
- Note
- Calling XXH32_digest() will not affect
statePtr, so you can update, digest, and update again.
- See also
- Streaming Example
◆ XXH32_canonicalFromHash()
| void XXH32_canonicalFromHash | ( | XXH32_canonical_t * | dst, |
| XXH32_hash_t | hash ) |
Converts an XXH32_hash_t to a big endian XXH32_canonical_t.
- Parameters
-
dst The XXH32_canonical_t pointer to be stored to. hash The XXH32_hash_t to be converted.
- Precondition
dstmust not be NULL.
- See also
- Canonical Representation Example
◆ XXH32_hashFromCanonical()
| XXH32_hash_t XXH32_hashFromCanonical | ( | const XXH32_canonical_t * | src | ) |
Converts an XXH32_canonical_t to a native XXH32_hash_t.
- Parameters
-
src The XXH32_canonical_t to convert.
- Precondition
srcmust not be NULL.
- Returns
- The converted hash.
- See also
- Canonical Representation Example