BLOG | DOCUMENTATION | TRAC

Home --> Documentations --> PJLIB-UTIL Reference

CRC32 (Cyclic Redundancy Check)

Data Structures

struct  pj_crc32_context
 

Functions

void pj_crc32_init (pj_crc32_context *ctx)
 
pj_uint32_t pj_crc32_update (pj_crc32_context *ctx, const pj_uint8_t *data, pj_size_t nbytes)
 
pj_uint32_t pj_crc32_final (pj_crc32_context *ctx)
 
pj_uint32_t pj_crc32_calc (const pj_uint8_t *data, pj_size_t nbytes)
 

Detailed Description

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

Function Documentation

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
dataInput data.
nbytesLength of input data.
Returns
CRC value of the data.
pj_uint32_t pj_crc32_final ( pj_crc32_context ctx)

Finalize CRC32 calculation and retrieve the CRC32 value.

Parameters
ctxCRC32 context.
Returns
The current CRC value.
void pj_crc32_init ( pj_crc32_context ctx)

Initialize CRC32 context.

Parameters
ctxCRC32 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
ctxCRC32 context.
dataInput data.
nbytesLength of the input data.
Returns
The current CRC32 value.

 


PJLIB-UTIL Open Source, small footprint, and portable asynchronous/caching DNS resolver, text scanner, STUN client, and XML library
Copyright (C) 2006-2009 Teluu Inc.