Group PJLIB_UTIL_CRC32

group PJLIB_UTIL_CRC32

This implements CRC32 algorithm. See ITU-T V.42 for the formal specification.

Functions

void pj_crc32_init(pj_crc32_context *ctx)

Initialize CRC32 context.

Parameters:

ctx – CRC32 context.

pj_uint32_t pj_crc32_update(pj_crc32_context *ctx, const pj_uint8_t *data, pj_size_t nbytes)

Feed data incrementally to the CRC32 algorithm.

Parameters:
  • ctx – CRC32 context.

  • data – Input data.

  • nbytes – Length of the input data.

Returns:

The current CRC32 value.

pj_uint32_t pj_crc32_final(pj_crc32_context *ctx)

Finalize CRC32 calculation and retrieve the CRC32 value.

Parameters:

ctx – CRC32 context.

Returns:

The current CRC value.

pj_uint32_t pj_crc32_calc(const pj_uint8_t *data, pj_size_t nbytes)

Perform one-off CRC32 calculation to the specified data.

Parameters:
  • data – Input data.

  • nbytes – Length of input data.

Returns:

CRC value of the data.

struct pj_crc32_context
#include <crc32.h>

CRC32 context.

Public Members

pj_uint32_t crc_state

Current state.