Skip to main content

CRC32

Overview

CRC stands for Cyclic Redundancy Check, a commonly used method for verifying the integrity of digital data. It is an error-detecting algorithm used to check if errors have occurred in digital data during transmission or storage. A CRC generates a short checksum or hash of the data being transmitted or stored, which is appended to the data. When the data is received or retrieved, 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. If they do not match, it indicates that an error has occurred and the data needs to be resent or retrieved again

The CRC32 IEEE version used for TL-B schemes. By viewing this NFT op code example a clearer understanding of calculation TL-B for various messages is achieved.

Tools

Python

import zlib
print(zlib.crc32(b'<TL-B>') & 0x7FFFFFFF)

Go

func main() {

var schema = "some"

schema = strings.ReplaceAll(schema, "(", "")
schema = strings.ReplaceAll(schema, ")", "")
data := []byte(schema)
var crc = crc32.Checksum(data, crc32.MakeTable(crc32.IEEE))

var b_data = make([]byte, 4)
binary.BigEndian.PutUint32(b_data, crc)
var res = hex.EncodeToString(b_data)
fmt.Println(res)

}