poser
A C framework for POsix SERvices
Loading...
Searching...
No Matches
PSC_Hash Class Reference

Calculate non-cryptographic hashes of some data. More...

#include <poser/core/hash.h>

Public Member Functions

PSC_HashPSC_Hash_create (int func, int flags)
 PSC_Hash default constructor.
 
uint64_t PSC_Hash_bytes (PSC_Hash *self, const uint8_t *data, size_t size)
 Calculate a hash from any data.
 
uint64_t PSC_Hash_string (PSC_Hash *self, const char *str)
 Calculate a hash from a string.
 
void PSC_Hash_destroy (PSC_Hash *self)
 PSC_Hash destructor.
 

Detailed Description

Calculate non-cryptographic hashes of some data.

This class hashes some given data using xxhash3.

Member Function Documentation

◆ PSC_Hash_bytes()

uint64_t PSC_Hash_bytes ( PSC_Hash self,
const uint8_t *  data,
size_t  size 
)

Calculate a hash from any data.

Parameters
selfthe PSC_Hash
datathe data to hash
sizethe size of the data
Returns
the hash value

◆ PSC_Hash_create()

PSC_Hash * PSC_Hash_create ( int  func,
int  flags 
)

PSC_Hash default constructor.

Creates a new PSC_Hash with given options

Parameters
functhe hash function to use, currently ignored, only xxhash3 is available
flagssettings for the selected hash function, 0 means defaults. For xxhash3, 1 means use a random secret (created only once for all PSC_Hash instances) while hashing
Returns
a newly created PSC_Hash, or NULL on error

◆ PSC_Hash_destroy()

void PSC_Hash_destroy ( PSC_Hash self)

PSC_Hash destructor.

Parameters
selfthe PSC_Hash

◆ PSC_Hash_string()

uint64_t PSC_Hash_string ( PSC_Hash self,
const char *  str 
)

Calculate a hash from a string.

Parameters
selfthe PSC_Hash
strthe string to hash
Returns
the hash value

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