d-bahr / CRCpp

Easy to use and fast C++ CRC library.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

can support crc32p4?

fengmao31 opened this issue · comments

I want to use crc32p4. But I cannot find the custom Polynomial parameter to input it.

CRC32P4 has the same parameters as CRC32 except it uses the polynomial 0xF4ACFB13.

Example:

const CRC::Parameters<crcpp_uint32, 32> crc32p4 = { 0xF4ACFB13, 0xFFFFFFFF, 0xFFFFFFFF, true, true };
std::vector<uint8_t> bytes = { 0x33, 0x22, 0x55, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF  };
crcpp_uint32 value = CRC::Calculate(bytes.data(), bytes.size(), crc32p4);
std::cout << value << std::endl;
// Prints "0xA65A343D"

Source for polynomial: https://www.autosar.org/fileadmin/standards/R22-11/CP/AUTOSAR_SWS_CRCLibrary.pdf