Open resilar opened 6 months ago
Note that a quine does not necessarily exist for a specific input and CRC function. However, some standardized CRC functions have an unique quine for every input (for other CRC functions, some inputs have multiple valid quines while other inputs have none). CRC functions that have unique quine for any input message include the following:
CRC-3/GSM -w3 -p3 -x7
CRC-3/ROHC -w3 -p3 -i7 -rR
CRC-4/G-704 -w4 -p3 -rR
CRC-4/INTERLAKEN -w4 -p3 -if -xf
CRC-5/EPC-C1G2 -w5 -p09 -i09
CRC-5/USB -w5 -p05 -i1f -rR -x1f
CRC-6/CDMA2000-A -w6 -p27 -i3f
CRC-6/G-704 -w6 -p03 -rR
CRC-7/MMC -w7 -p09
CRC-8/DARC -w8 -p39 -rR
CRC-8/GSM-A -w8 -p1d
CRC-8/HITAG -w8 -p1d -iff
CRC-8/I-CODE -w8 -p1d -ifd
CRC-8/MIFARE-MAD -w8 -p1d -ic7
CRC-8/SAE-J1850 -w8 -p1d -iff -xff
CRC-8/TECH-3250 -w8 -p1d -iff -rR
CRC-12/GSM -w12 -pd31 -xfff
CRC-15/MPT1327 -w15 -p6815 -x0001
CRC-16/CDMA2000 -w16 -pc867 -iffff
CRC-16/LJ1200 -w16 -p6f63
CRC-16/M17 -w16 -p5935 -iffff
CRC-16/OPENSAFETY-A -w16 -p5935
CRC-16/OPENSAFETY-B -w16 -p755b
CRC-16/PROFIBUS -w16 -p1dcf -iffff -xffff
CRC-16/T10-DIF -w16 -p8bb7
CRC-32/BZIP2 -w32 -p04c11db7 -iffffffff -xffffffff
CRC-32/CKSUM -w32 -p04c11db7 -xffffffff
CRC-32/MPEG-2 -w32 -p04c11db7 -iffffffff
CRC-32/XFER -w32 -p000000af
The listed CRC function names and parameters have been taken from the file check.sh
Yes. In principle, we could define a file format that includes a self-referential CRC checksum (that is calculated over the entire file) in its header. This would unironically simplify parsing of such file format.
Implement a feature to calculate CRC quines. For example:
sagemath proof of concept: