Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
Hashing functions

General functions for hashing data. More...

Collaboration diagram for Hashing functions:

Functions

uint32_t HASH_fnv1a_32 (const void *data_in, size_t num_bytes)
 Calculate the 32-bit fnv1a non-crypto hash of a block of data. More...
 
uint64_t HASH_fnv1a_64 (const void *data_in, size_t num_bytes)
 Calculate the 64-bit fnv1a non-crypto hash of a block of data. More...
 
void HASH_fnv1a_64_stream (const void *data_in, size_t num_bytes, uint64_t *hash)
 Streaming version of HASH_fnv1a_64. More...
 
uint32_t HASH_CRC32 (uint8_t *data, uint32_t dataLen)
 Calculate the CRC32 hash of a block of data. More...
 
void HASH_CRC32_stream (uint8_t *data, uint32_t dataLen, uint32_t *crc)
 Streaming version of HASH_CRC32. More...
 

Detailed Description

General functions for hashing data.

Function Documentation

◆ HASH_CRC32()

uint32_t HASH_CRC32 ( uint8_t *  data,
uint32_t  dataLen 
)

Calculate the CRC32 hash of a block of data.

Parameters
dataThe data to hash
dataLenThe sizeof the data to be hashed (in bytes)
Returns
32-bit CRC hash

◆ HASH_CRC32_stream()

void HASH_CRC32_stream ( uint8_t *  data,
uint32_t  dataLen,
uint32_t *  crc 
)

Streaming version of HASH_CRC32.

Usage notes: This function leaves out

  1. The initialisation of the CRC to 0xFFFFFFFF at the beginning, and
  2. the one's complement operation at the end. So these two steps have to be handled outside of this function, by the code that uses it. (For example, see HASH_CRC32, which uses HASH_CRC32_stream).
Parameters
dataThe data to hash
dataLenThe sizeof the data to be hashed (in bytes)
crcOutput variable into which the (partial) crc computation is stored

◆ HASH_fnv1a_32()

uint32_t HASH_fnv1a_32 ( const void *  data_in,
size_t  num_bytes 
)

Calculate the 32-bit fnv1a non-crypto hash of a block of data.

Parameters
data_inThe data to hash
num_bytesThe sizeof the data to be hashed (in bytes)
Returns
32-bit fnv1a non-crypto hash

◆ HASH_fnv1a_64()

uint64_t HASH_fnv1a_64 ( const void *  data_in,
size_t  num_bytes 
)

Calculate the 64-bit fnv1a non-crypto hash of a block of data.

Parameters
data_inThe data to hash
num_bytesThe sizeof the data to be hashed (in bytes)
Returns
64-bit fnv1a non-crypto hash

◆ HASH_fnv1a_64_stream()

void HASH_fnv1a_64_stream ( const void *  data_in,
size_t  num_bytes,
uint64_t *  hash 
)

Streaming version of HASH_fnv1a_64.

Usage note: This function leaves out the initialisation of the hash to the basis64 at the beginning. So this has to be done before this function is done. (For example, see HASH_fnv1a_64, which uses HASH_fnv1a_64_stream).

Parameters
data_inThe data to hash
num_bytesThe sizeof the data to be hashed (in bytes)
hashOutput variable into which the (partial) hash computation is stored Should be initialised to basis64 (14695981039346656037ULL)