libcoap  4.3.0
coap_hashkey.h File Reference

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

#include "libcoap.h"
#include "uthash.h"
#include "str.h"
+ Include dependency graph for coap_hashkey.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.h.

Macro Definition Documentation

◆ COAP_DEFAULT_HASH

#define COAP_DEFAULT_HASH

Definition at line 42 of file coap_hashkey.h.

◆ coap_hash

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

Definition at line 38 of file coap_hashkey.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.h.

Typedef Documentation

◆ coap_key_t

typedef unsigned char coap_key_t[4]

Definition at line 24 of file coap_hashkey.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 14 of file coap_hashkey.c.