datasketches-cpp
Public Member Functions | Static Public Member Functions | List of all members
XXHash64 Class Reference

XXHash (64 bit), based on Yann Collet's descriptions, see http://cyan4973.github.io/xxHash/. More...

#include <xxhash64.h>

Public Member Functions

 XXHash64 (uint64_t seed)
 create new XXHash (64 bit) More...
 
bool add (const void *input, uint64_t length)
 add a chunk of bytes More...
 
uint64_t hash () const
 get current hash More...
 

Static Public Member Functions

static uint64_t hash (const void *input, uint64_t length, uint64_t seed)
 combine constructor, add() and hash() in one static function (C style) More...
 

Detailed Description

XXHash (64 bit), based on Yann Collet's descriptions, see http://cyan4973.github.io/xxHash/.

How to use: uint64_t myseed = 0; XXHash64 myhash(myseed); myhash.add(pointerToSomeBytes, numberOfBytes); myhash.add(pointerToSomeMoreBytes, numberOfMoreBytes); // call add() as often as you like to ... and compute hash: uint64_t result = myhash.hash();

or all of the above in one single line: uint64_t result2 = XXHash64::hash(mypointer, numBytes, myseed);

Note: my code is NOT endian-aware !

Constructor & Destructor Documentation

◆ XXHash64()

XXHash64 ( uint64_t  seed)
inlineexplicit

create new XXHash (64 bit)

Parameters
seedyour seed value, even zero is a valid seed

Member Function Documentation

◆ add()

bool add ( const void *  input,
uint64_t  length 
)
inline

add a chunk of bytes

Parameters
inputpointer to a continuous block of data
lengthnumber of bytes
Returns
false if parameters are invalid / zero

◆ hash() [1/2]

uint64_t hash ( ) const
inline

get current hash

Returns
64 bit XXHash

◆ hash() [2/2]

static uint64_t hash ( const void *  input,
uint64_t  length,
uint64_t  seed 
)
inlinestatic

combine constructor, add() and hash() in one static function (C style)

Parameters
inputpointer to a continuous block of data
lengthnumber of bytes
seedyour seed value, e.g. zero is a valid seed
Returns
64 bit XXHash

The documentation for this class was generated from the following file: