To better understand the role of CRC-32
in the TON network and its relation to Bag of Cells (BOCs)
, it is essential to first learn about the concept of Cyclic Redundancy Check (CRC) and its primary purpose.
CRC is a widely employed method for verifying the integrity of digital data. As an error-detecting algorithm, it checks for errors in digital data during transmission or storage.
A CRC generates a short checksum or hash of the data being transmitted or stored, which is then appended to the data itself. Upon receiving or retrieving the data, the CRC is recalculated and compared to the original checksum. If the two checksums match, it is assumed that the data has not been corrupted. However, if they do not match, it indicates that an error has occurred, and the data must be resent or retrieved again.
CRC-32, a 32-bit variation of the CRC algorithm
, is designed to detect accidental changes to raw data in digital networks and storage devices. By calculating a 32-bit checksum for the input data, it helps maintain data integrity during transmission or storage.
**Within the TON network, CRC-32 is used as a component of the Bag of Cells (BOC) serialization format to ensure data integrity.**
BOC is a binary format representing a tree of cells, used for data storage and transmission in the TON network. Each cell in a BOC contains a small piece of data and may have references to other cells.
During the serialization or deserialization of a BOC, a CRC-32 checksum is calculated for the cell data to ensure that it has not been corrupted during transmission or storage. If the calculated CRC-32 checksum does not match the one stored in the BOC, it indicates that the data is corrupted and needs to be retransmitted or retrieved again.
For more information on CRC-32 and its usage within the TON network, refer to the following resources:
- TON Documentation on CRC-32: https://docs.ton.org/develop/data-formats/crc32
- Online CRC-16 Calculator: https://emn178.github.io/online-tools/crc16.html