#include <stddef.h>
Go to the source code of this file.
|
typedef unsigned int | XXH32_hash_t |
|
typedef struct XXH32_state_s | XXH32_state_t |
| The opaque state struct for the XXH32 streaming API.
|
|
typedef struct XXH64_state_s | XXH64_state_t |
| The opaque state struct for the XXH64 streaming API.
|
|
|
typedef unsigned long long | XXH64_hash_t |
|
|
XXH_PUBLIC_API unsigned | XXH_versionNumber (void) |
|
XXH_PUBLIC_API XXH32_hash_t | XXH32 (const void *input, size_t length, unsigned int seed) |
| Calculates the 32-bit hash of input using xxHash32.
|
|
XXH_PUBLIC_API XXH32_state_t * | XXH32_createState (void) |
|
XXH_PUBLIC_API XXH_errorcode | XXH32_freeState (XXH32_state_t *statePtr) |
| Frees an XXH32_state_t.
|
|
XXH_PUBLIC_API void | XXH32_copyState (XXH32_state_t *dst_state, const XXH32_state_t *src_state) |
| Copies one XXH32_state_t to another.
|
|
XXH_PUBLIC_API XXH_errorcode | XXH32_reset (XXH32_state_t *statePtr, unsigned int seed) |
| Resets an XXH32_state_t to begin a new hash.
|
|
XXH_PUBLIC_API XXH_errorcode | XXH32_update (XXH32_state_t *statePtr, const void *input, size_t length) |
| Consumes a block of input to an XXH32_state_t.
|
|
XXH_PUBLIC_API XXH32_hash_t | XXH32_digest (const XXH32_state_t *statePtr) |
| Returns the calculated hash value from an XXH32_state_t.
|
|
XXH_PUBLIC_API void | XXH32_canonicalFromHash (XXH32_canonical_t *dst, XXH32_hash_t hash) |
| Converts an XXH32_hash_t to a big endian XXH32_canonical_t.
|
|
XXH_PUBLIC_API XXH32_hash_t | XXH32_hashFromCanonical (const XXH32_canonical_t *src) |
| Converts an XXH32_canonical_t to a native XXH32_hash_t.
|
|
XXH_PUBLIC_API XXH64_hash_t | XXH64 (const void *input, size_t length, unsigned long long seed) |
| Calculates the 64-bit hash of input using xxHash64.
|
|
XXH_PUBLIC_API XXH64_state_t * | XXH64_createState (void) |
|
XXH_PUBLIC_API XXH_errorcode | XXH64_freeState (XXH64_state_t *statePtr) |
|
XXH_PUBLIC_API void | XXH64_copyState (XXH64_state_t *dst_state, const XXH64_state_t *src_state) |
|
XXH_PUBLIC_API XXH_errorcode | XXH64_reset (XXH64_state_t *statePtr, unsigned long long seed) |
|
XXH_PUBLIC_API XXH_errorcode | XXH64_update (XXH64_state_t *statePtr, const void *input, size_t length) |
|
XXH_PUBLIC_API XXH64_hash_t | XXH64_digest (const XXH64_state_t *statePtr) |
|
XXH_PUBLIC_API void | XXH64_canonicalFromHash (XXH64_canonical_t *dst, XXH64_hash_t hash) |
|
XXH_PUBLIC_API XXH64_hash_t | XXH64_hashFromCanonical (const XXH64_canonical_t *src) |
|
◆ XXH_PUBLIC_API
#define XXH_PUBLIC_API /* do nothing */ |
XXH_INLINE_ALL (and XXH_PRIVATE_API) This is useful to include xxhash functions in static
mode in order to inline them, and remove their symbol from the public list. Inlining can offer dramatic performance improvement on small keys. Methodology : #define XXH_INLINE_ALL #include "xxhash.h" xxhash.c
is automatically included. It's not useful to compile and link it as a separate module.
◆ XXH_VERSION_MAJOR
#define XXH_VERSION_MAJOR 0 |
XXH_NAMESPACE, aka Namespace Emulation :
If you want to include and expose xxHash functions from within your own library, but also want to avoid symbol collisions with other libraries which may also include xxHash,
you can use XXH_NAMESPACE, to automatically prefix any public symbol from xxhash library with the value of XXH_NAMESPACE (therefore, avoid NULL and numeric values).
Note that no change is required within the calling program as long as it includes xxhash.h
: regular symbol name will be automatically translated by this header.
◆ XXH_VERSION_MINOR
#define XXH_VERSION_MINOR 6 |
◆ XXH_VERSION_NUMBER
◆ XXH_VERSION_RELEASE
#define XXH_VERSION_RELEASE 5 |
◆ XXH32_hash_t
◆ XXH_errorcode
Enumerator |
---|
XXH_OK | |
XXH_ERROR | |
◆ XXH32()
Calculates the 32-bit hash of input
using xxHash32.
XXH32() : Calculate the 32-bit hash of sequence "length" bytes stored at memory address "input". The memory between input & input+length must be valid (allocated and read-accessible). "seed" can be used to alter the result predictably. Speed on Core 2 Duo @ 3 GHz (single thread, SMHasher benchmark) : 5.4 GB/s
Speed on Core 2 Duo @ 3 GHz (single thread, SMHasher benchmark): 5.4 GB/s
- Parameters
-
input | The block of data to be hashed, at least length bytes 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
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 32-bit hash value.
- See also
- XXH64(), XXH3_64bits_withSeed(), XXH3_128bits_withSeed(), XXH128(): Direct equivalents for the other variants of xxHash.
-
XXH32_createState(), XXH32_update(), XXH32_digest(): Streaming version.
◆ XXH32_canonicalFromHash()
Converts an XXH32_hash_t to a big endian XXH32_canonical_t.
Default XXH result types are basic unsigned 32 and 64 bits. The canonical representation follows human-readable write convention, aka big-endian (large digits first). These functions allow transformation of hash result into and from its canonical format. This way, hash values can be written into a file or buffer, remaining comparable across different systems.
- Parameters
-
- Precondition
dst
must not be NULL
.
Default XXH result types are basic unsigned 32 and 64 bits. The canonical representation follows human-readable write convention, aka big-endian (large digits first). These functions allow transformation of hash result into and from its canonical format. This way, hash values can be written into a file or buffer, remaining comparable across different systems.
◆ XXH32_copyState()
Copies one XXH32_state_t to another.
- Parameters
-
dst_state | The state to copy to. |
src_state | The state to copy from. |
- Precondition
dst_state
and src_state
must not be NULL
and must not overlap.
◆ XXH32_createState()
◆ XXH32_digest()
Returns the calculated hash value from an XXH32_state_t.
- Note
- Calling XXH32_digest() will not affect
statePtr
, so you can update, digest, and update again.
- Parameters
-
statePtr | The state struct to calculate the hash from. |
- Precondition
statePtr
must not be NULL
.
- Returns
- The calculated xxHash32 value from that state.
◆ XXH32_freeState()
◆ XXH32_hashFromCanonical()
◆ XXH32_reset()
Resets an XXH32_state_t to begin a new hash.
This function resets and seeds a state. Call it before XXH32_update().
- Parameters
-
statePtr | The state struct to reset. |
seed | The 32-bit seed to alter the hash result predictably. |
- Precondition
statePtr
must not be NULL
.
- Returns
- XXH_OK on success, XXH_ERROR on failure.
◆ XXH32_update()
Consumes a block of input
to an XXH32_state_t.
Call this to incrementally consume blocks of data.
- Parameters
-
statePtr | The state struct to update. |
input | The block of data to be hashed, at least length bytes in size. |
length | The 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()
Calculates the 64-bit hash of input
using xxHash64.
XXH64() : Calculate the 64-bit hash of sequence of length "len" stored at memory address "input". "seed" can be used to alter the result predictably. This function runs faster on 64-bit systems, but slower on 32-bit systems (see benchmark).
This function usually runs faster on 64-bit systems, but slower on 32-bit systems (see benchmark).
- Parameters
-
input | The block of data to be hashed, at least length bytes in size. |
length | The length of input , in bytes. |
seed | The 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_canonicalFromHash()
◆ XXH64_copyState()
◆ XXH64_createState()
◆ XXH64_digest()
◆ XXH64_freeState()
◆ XXH64_hashFromCanonical()
◆ XXH64_reset()
◆ XXH64_update()
◆ XXH_versionNumber()