CRC-32¶
-
uint32_t cardano_checksum_crc32(const byte_t *data, size_t size)¶
Computes the CRC32 checksum for the given data.
This function calculates a 32-bit cyclic redundancy check (CRC32) checksum, used to detect accidental changes to raw data. CRC32 checksums are a common method for ensuring the integrity of data by producing a short, fixed-size checksum based on the input data.
Usage Example:
const char* sample_data = "Hello, world!"; size_t data_size = strlen(sample_data); uint32_t checksum = cardano_checksum_crc32(sample_data, data_size); printf("CRC32 Checksum: %u\n", checksum);Note
This function does not modify the input data. If the data pointer is NULL or size is zero, the function should return 0 as the checksum, which must be handled by the caller.