|
| | jcrc (auth_t auth, uint64_t poly=0, uint32_t polylen=0, bool zeroinit=false, bool swapin=true, bool swapout=true, bool compout=true) |
| |
|
virtual | ~jcrc ()=default |
| | Standard deconstructor.
|
| |
| void | ProcessData (const uint8_t *input, uint32_t length, uint64_t partial=0) |
| |
| uint64_t | partial () |
| |
| void | result (uint8_t *crc) |
| |
| uint32_t | result_size () |
| |
|
| jcrc (jcrc &rhs)=delete |
| |
|
| jcrc (const jcrc &rhs)=delete |
| |
◆ jcrc()
| ProtocolPP::jcrc::jcrc |
( |
auth_t |
auth, |
|
|
uint64_t |
poly = 0, |
|
|
uint32_t |
polylen = 0, |
|
|
bool |
zeroinit = false, |
|
|
bool |
swapin = true, |
|
|
bool |
swapout = true, |
|
|
bool |
compout = true |
|
) |
| |
|
explicit |
Interface for CRC calculation
Use custom polynomials with CRC_POLY. If CRC_POLY is used, all other inputs are required (poly, polylen, zeroinit, swapin, swapout, compout)
- Parameters
-
| auth | - CRC type(CRC5_USB, CRC7_UTMS, CRC8_LTE, CRC11_UTMS, CRC12_UTMS, CRC16_IBM, CRC16_CCITT, CRC24_LTE_A, CRC24_LTE_B, CRC32_IETF, CRC32_IEEE, CRC64_ISO, CRC64_ECMA, CRC_POLY) |
| poly | - Polynomial for CRC calculation |
| polylen | - Polynomial length for CRC calculation |
| zeroinit | - Use all zero initial value for CRC |
| swapin | - Swap input data for CRC value |
| swapout | - Swap output data for CRC value |
| compout | - Complement final result |
◆ partial()
| uint64_t ProtocolPP::jcrc::partial |
( |
| ) |
|
Retrieves the partial CRC value. If result() has previously been called then this function will return a value of zero. In this way a running CRC can be calculated either by calling ProcessData() with multiple sets of data or the partial CRC can be saved, a new CRC engine can be constructed at a latter time, and the partial CRC can be passed in on the first ProcessData() after the new engine is constructed
- Returns
- the partially calculated CRC
◆ ProcessData()
| void ProtocolPP::jcrc::ProcessData |
( |
const uint8_t * |
input, |
|
|
uint32_t |
length, |
|
|
uint64_t |
partial = 0 |
|
) |
| |
Calculates the CRC for the input data, stays in intermediate state until result() is called at which time swapout and comput are applied
- Parameters
-
| input | - Input data to process |
| length | - Data length |
| partial | - Previous partial calculation of CRC |
◆ result()
| void ProtocolPP::jcrc::result |
( |
uint8_t * |
crc | ) |
|
Retrieves the CRC value. The final bit-swap and complement is applied only when result() is called
- Parameters
-
| crc | - CRC calculated value |
◆ result_size()
| uint32_t ProtocolPP::jcrc::result_size |
( |
| ) |
|
Size of the result
- Returns
- size of the CRC
The documentation for this class was generated from the following file: