libcoap 4.3.4
coap_hashkey_internal.h File Reference

Definition of hash key type and helper functions. More...

#include "libcoap.h"
#include "coap_uthash_internal.h"
#include "coap_str.h"
+ Include dependency graph for coap_hashkey_internal.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define coap_hash(String, Length, Result)    coap_hash_impl((String),(Length),(Result))
 
#define COAP_DEFAULT_HASH
 
#define coap_str_hash(Str, H)
 Calls coap_hash() with given coap_string_t object as parameter. More...
 

Typedefs

typedef unsigned char coap_key_t[4]
 

Functions

void coap_hash_impl (const unsigned char *s, size_t len, coap_key_t h)
 Calculates a fast hash over the given string s of length len and stores the result into h. More...
 

Detailed Description

Definition of hash key type and helper functions.

Definition in file coap_hashkey_internal.h.

Macro Definition Documentation

◆ COAP_DEFAULT_HASH

#define COAP_DEFAULT_HASH

Definition at line 42 of file coap_hashkey_internal.h.

◆ coap_hash

#define coap_hash (   String,
  Length,
  Result 
)     coap_hash_impl((String),(Length),(Result))

Definition at line 38 of file coap_hashkey_internal.h.

◆ coap_str_hash

#define coap_str_hash (   Str,
 
)

Calls coap_hash() with given coap_string_t object as parameter.

Parameters
StrMust contain a pointer to a coap string object.
HA coap_key_t object to store the result.

Definition at line 55 of file coap_hashkey_internal.h.

Typedef Documentation

◆ coap_key_t

typedef unsigned char coap_key_t[4]

Definition at line 24 of file coap_hashkey_internal.h.

Function Documentation

◆ coap_hash_impl()

void coap_hash_impl ( const unsigned char *  s,
size_t  len,
coap_key_t  h 
)

Calculates a fast hash over the given string s of length len and stores the result into h.

Depending on the exact implementation, this function cannot be used as one-way function to check message integrity or simlar.

Parameters
sThe string used for hash calculation.
lenThe length of s.
hThe result buffer to store the calculated hash key.

Definition at line 19 of file coap_hashkey.c.