Hello,
I am trying to used crc64 function in crc_common.hpp to compute crc64. However is is nor clear to me what should be the const poly64_t constants[] parameter. According to the function description:
const poly64_t constants[] parameter. According to the function description:
/** * Computes a CRC64 in big- or little-endian mode using the specified shifts * and polynomials. This can be used for smaller polynomials by shifting * them to a degree 64 polynomial. * * @tparam BarretShift the shift used when computing @c ls1_divp. * @param[in] size number of bytes of the given buffer * @param[in] input points to the input byte sequence * @param[out] crc24 the computed CRC on 24 bits * @param[in] constants the constants specific to each polynomial: constants[0] = padding constants[1] = (1<<128) / P - (1<<64) constants[2:11] = [ (1<<(64*k)) mod P, for k in [1,1,2,3,4,5,6,7,8,9] ] */ What "constants[1] = (1<<128) / P - (1<<64)" stands for? The result doesnt seems to be a 64th bit polynomial. Thanks
Hi there,
“constants” is an array of poly64_t. Each poly64_t is an unsigned integer representation of the coefficients of a GF(2) polynomial (that is, a polynomial with coefficients 0 or 1). For example, 1<<64 can represent x^64. P is the generator polynomial of the CRC being calculated. The modulus and division operators here are polynomial modulus and division, so:
(1<<128) / P - (1<<64)
is the poly64_t representation of the polynomial
x^128 / (some degree 64 polynomial) - x^64
Please note that crc64 isn’t intended to be a user-callable function so it does not include full documentation on how to generate all the parameters. Instead it is a common implementation that underlies all our user-callable CRC routines.
Regards,
Nick
Thanks Nick. Assuming that I would like to evaluate crc64 for the following polynomial : 0xad93d23594c935a9 what should I fill into the constants?
Thanks
Could I clarify, please: is the most-significant bit of your polynomial assumed to be 1, and therefore not stored in that representation? Or is it a degree-63 polynomial with the most-significant bit explictly stored?
Many thanks,
Hi Nick, this is crc-64-jones polynomial. Definition is from https://pycrc.org/models.html :
Thanks a lot!
dan
Unfortunately our crc64 function is not suitable for evaluating arbitrary 64-bit polynomials. Because we are focused on 5G applications we have only implemented the CRCs listed in the appropriate 5G standard (Technical Specification 38.212) and these have a maximum length of 24 bits. The code is not designed to support longer CRCs.
It would be interesting to know the application domain for the crc-64-jones polynomial, however. Is it used in a different telecommunications specification, for example?
Apologies,