Lines Matching full:crc
12 * @brief CRC computation function
34 /* Initial value expected to be used at the beginning of the OpenPGP CRC-24 computation. */
37 * The CRC-24 value is stored on a 32-bit value, only the 3 least significant bytes
38 * are meaningful. Use the following mask to only keep the CRC-24 value.
48 * @defgroup crc CRC
54 * @brief CRC algorithm enumeration
56 * These values should be used with the @ref crc dispatch function.
75 * @brief Generic function for computing a CRC-16 without input or output
78 * Compute CRC-16 by passing in the address of the input, the input length
82 * @note If you are planning to use a CRC based on poly 0x1012 the functions
87 * @param seed Initial value for the CRC computation
96 * @brief Generic function for computing a CRC-16 with input and output
99 * Compute CRC-16 by passing in the address of the input, the input length
103 * @note If you are planning to use a CRC based on poly 0x1012 the function
108 * calculated CRC is XORed with:
110 * - CRC-16/ANSI, CRC-16/MODBUS, CRC-16/USB, CRC-16/IBM
111 * https://reveng.sourceforge.io/crc-catalogue/16.htm#crc.cat.crc-16-modbus
116 * use 0xA001 instead of 0x8005 for CRC-16-MODBUS.
117 * @param seed Initial value for the CRC computation
125 * @brief Generic function for computing CRC 8
127 * Compute CRC 8 by passing in the address of the input, the input length
134 * @param initial_value Initial value for the CRC computation
146 * This function is able to calculate any CRC that uses 0x1021 as it polynomial
152 * calculated CRC is XORed with:
154 * - CRC-16/CCITT, CRC-16/CCITT-TRUE, CRC-16/KERMIT
155 * https://reveng.sourceforge.io/crc-catalogue/16.htm#crc.cat.crc-16-kermit
158 * - CRC-16/X-25, CRC-16/IBM-SDLC, CRC-16/ISO-HDLC
159 * https://reveng.sourceforge.io/crc-catalogue/16.htm#crc.cat.crc-16-ibm-sdlc
162 * @note To calculate the CRC across non-contiguous blocks use the return
167 * @param seed Value to seed the CRC with
179 * This function is able to calculate any CRC that uses 0x1021 as it polynomial
185 * calculated CRC is XORed with:
187 * - CRC-16/XMODEM, CRC-16/ACORN, CRC-16/LTE
188 * https://reveng.sourceforge.io/crc-catalogue/16.htm#crc.cat.crc-16-xmodem
191 * - CRC16/CCITT-FALSE, CRC-16/IBM-3740, CRC-16/AUTOSAR
192 * https://reveng.sourceforge.io/crc-catalogue/16.htm#crc.cat.crc-16-ibm-3740
195 * - CRC-16/GSM
196 * https://reveng.sourceforge.io/crc-catalogue/16.htm#crc.cat.crc-16-gsm
199 * @note To calculate the CRC across non-contiguous blocks use the return
204 * @param seed Value to seed the CRC with
213 * @brief Compute the ANSI (or Modbus) variant of CRC-16
215 * The ANSI variant of CRC-16 uses 0x8005 (0xA001 reflected) as its polynomial
231 * @param data Pointer to data on which the CRC should be calculated.
242 * @param crc CRC32 checksum that needs to be updated.
243 * @param data Pointer to data on which the CRC should be calculated.
249 uint32_t crc32_ieee_update(uint32_t crc, const uint8_t *data, size_t len);
254 * @param crc CRC32C checksum that needs to be updated.
255 * @param data Pointer to data on which the CRC should be calculated.
263 uint32_t crc32_c(uint32_t crc, const uint8_t *data,
267 * @brief Compute CCITT variant of CRC 8
269 * Normal CCITT variant of CRC 8 is using 0x07.
271 * @param initial_value Initial value for the CRC computation
280 * @brief Compute ROHC variant of CRC 8
282 * ROHC (Robust Header Compression) variant of CRC 8.
285 * @param initial_value Initial value for the CRC computation
294 * @brief Compute the CRC-7 checksum of a buffer.
297 * polynomial with no reflection. The CRC is left
298 * justified, so bit 7 of the result is bit 6 of the CRC.
300 * @param seed Value to seed the CRC with
309 * @brief Compute the CRC-4 checksum of a buffer.
313 * bits of the CRC result will be set to zero.
315 * @param seed Value to seed the CRC with
324 * @brief Generic function for computing CRC 4
326 * Compute CRC 4 by passing in the address of the input, the input length
335 * @param initial_value Initial value for the CRC computation
344 * @brief Generate an OpenPGP CRC-24 checksum as defined in RFC 4880 section 6.1.
346 * @param data A pointer to the data on which the CRC will be calculated.
349 * @return The CRC-24 value.
354 * @brief Update an OpenPGP CRC-24 checksum.
356 * @param crc The CRC-24 checksum that needs to be updated. The full 32-bit value of the CRC needs
358 * @param data A pointer to the data on which the CRC will be calculated.
361 * @return The CRC-24 value. When the last buffer of data has been processed, mask the value
362 * with CRC24_FINAL_VALUE_MASK to keep only the meaningful 24 bits of the CRC result.
364 uint32_t crc24_pgp_update(uint32_t crc, const uint8_t *data, size_t len);
367 * @brief Compute a CRC checksum, in a generic way.
369 * This is a dispatch function that calls the individual CRC routine
378 * @param type CRC algorithm to use.
381 * @param seed Value to seed the CRC with
386 * @return uint32_t the computed CRC value
418 uint32_t crc = crc24_pgp_update(seed, src, len); in crc_by_type() local
421 crc &= CRC24_FINAL_VALUE_MASK; in crc_by_type()
422 return crc; in crc_by_type()