CRCs

Programming related discussions related to game research
Garo
Posts: 20
Joined: Wed Nov 18, 2020 5:54 pm

CRCs

Post by Garo »

What is a CRC, and what does it do?
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: CRCs

Post by aluigi »

Sort of numeric representation of a sequence of bytes mainly used to quickly check the integrity of the original bytes.
There are many types of implementations.
32bit CRC and checksums were often used in the past.
ZIP archives and TCP/IP packets are two examples of formats that adopt 32bit CRC in them.

Nowadays there is more interest in using hashes rather than 32bit CRC, hashes are longer and more complex limiting the collisions.
MD5 and SHA are hashes.

Hashes are also often used in cryptography (HMAC) for granting security to integrity.

Anyway Google is better than me at explaining these things.
Garo
Posts: 20
Joined: Wed Nov 18, 2020 5:54 pm

Re: CRCs

Post by Garo »

Google's no fun.

So they check if modified bytes function correctly?
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: CRCs

Post by aluigi »

Yeah, integrity indeed.
If you have a ZIP file and you edit the raw content of the archived file without changing the CRC, the software will tell you that there is an error in the archive.

But there are also cases where they are used to reference other content without writing that content again, for example there are situations where:
- crc/hash is used to idenfity the filename which is not stored anywhere in the archive, the content of the file will use the crc/hash only
- crc/hash is used to identify a particular string to use in a game and the multi-language content is associated to that crc/hash