API Reference Manual  1.45.0
ODP HASH

API Description

Hash functions.

Data Structures

struct  odp_hash_crc_param_t
 CRC parameters. More...
 

Typedefs

typedef struct odp_hash_crc_param_t odp_hash_crc_param_t
 CRC parameters. More...
 

Functions

uint32_t odp_hash_crc32 (const void *data, uint32_t data_len, uint32_t init_val)
 Calculate CRC-32. More...
 
uint32_t odp_hash_crc32c (const void *data, uint32_t data_len, uint32_t init_val)
 Calculate CRC-32C. More...
 
int odp_hash_crc_gen64 (const void *data, uint32_t data_len, uint64_t init_val, odp_hash_crc_param_t *crc_param, uint64_t *crc)
 Calculate up to 64 bit CRC using the given parameters. More...
 

Typedef Documentation

◆ odp_hash_crc_param_t

CRC parameters.

Supports CRCs up to 64 bits

Function Documentation

◆ odp_hash_crc32()

uint32_t odp_hash_crc32 ( const void *  data,
uint32_t  data_len,
uint32_t  init_val 
)

Calculate CRC-32.

Calculates CRC-32 over the data. The polynomial is 0x04c11db7.

Parameters
dataPointer to data
data_lenData length in bytes
init_valCRC generator initialization value
Returns
CRC32 value
Examples
odp_crc.c.

◆ odp_hash_crc32c()

uint32_t odp_hash_crc32c ( const void *  data,
uint32_t  data_len,
uint32_t  init_val 
)

Calculate CRC-32C.

Calculates CRC-32C (a.k.a. CRC-32 Castagnoli) over the data. The polynomial is 0x1edc6f41.

Parameters
dataPointer to data
data_lenData length in bytes
init_valCRC generator initialization value
Returns
CRC32C value
Examples
odp_cpu_bench.c, odp_crc.c, odp_simple_pipeline.c, and odp_switch.c.

◆ odp_hash_crc_gen64()

int odp_hash_crc_gen64 ( const void *  data,
uint32_t  data_len,
uint64_t  init_val,
odp_hash_crc_param_t crc_param,
uint64_t *  crc 
)

Calculate up to 64 bit CRC using the given parameters.

Calculates CRC over the data using the given parameters.

Parameters
dataPointer to data
data_lenData length in bytes
init_valCRC generator initialization value
crc_paramCRC parameters
crcPointer for CRC output
Returns
0 on success, <0 on failure (e.g. not supported algorithm)