libdatatypes 0.3.2
Abstract datatypes for C.
Loading...
Searching...
No Matches
hash.h File Reference

Hash functions. More...

#include <stdint.h>

Go to the source code of this file.

Typedefs

typedef uint32_t(* HashFunc) (const void *ptr)
 

Functions

uint32_t str_hash (const void *ptr)
 
uint32_t direct_hash (const void *ptr)
 

Detailed Description

Hash functions.

Author
Sebastian Fedrau sebas.nosp@m.tian.nosp@m..fedr.nosp@m.au@g.nosp@m.mail..nosp@m.com

Definition in file hash.h.

Typedef Documentation

◆ HashFunc

typedef uint32_t(* HashFunc) (const void *ptr)

Specifies the type of the hash function which is passed to hashtable_new() or hashtable_init().

Definition at line 28 of file hash.h.

Function Documentation

◆ direct_hash()

uint32_t direct_hash ( const void *  ptr)
Parameters
ptrpointer to convert
Returns
hash digest

Converts a pointer to a hash value.

Definition at line 44 of file hash.c.

◆ str_hash()

uint32_t str_hash ( const void *  ptr)
Parameters
ptrpointer to a string
Returns
hash digest

Calculates the hash digest of a string.

Definition at line 28 of file hash.c.