Thanks for taking the time to implement CRC.jl - I recently discovered and found it very practical for some work I was doing with CAN-bus data. The protocol I was working with does not use one of the pre-defined CRCs in CRC.jl
(v4.0.0) so I went looking at the referenced website, RevEng, to see if it was there.
It happens that it wasn't there, but whilst I was looking I wrote a bit of code which looks at the RevEng website for CRC definitions, and then writes a block of Julia code which could be updated in CRC.jl
to support the most up to date list from the RevEng website.
Please feel free to check it and if it looks ok, make use of it for a future version of CRC.jl
if you'd like.
If the code which generated this list would be of any use to help keep this aspect of CRC.jl
up to date, please let me know how best to share it (regrettably I'm quite new and I don't know my way around 'pull requests' yet).
I also wrote a few lines of code which autmatically generate the exported CRCs and the big dictionary of all of these, without having to write each line of code for each of the 65 (or 112) defined CRCs.
- It might help if there was interest to have CRC.jl
automatically update by cross checking the RevEng website.
- That said, I don't know if there is a demand for a feature like this, and the automatic updates would only go for as long as the RevEng website remained online.
- Therefore I got this code to write its output to a file which could just be copied and pasted, because I thought this might be of more use and fitting with the design of CRC.jl
as it is right now.
- Nevertheless if an auto-updating feature would be of any interest, I'd be happy to share this as well, just let me know how.
I don't expect it to be causing any problems the way it is defined, but I am curious if there is a reason why this is defined in this way (so I can learn if there are other reasons why this is handy in this situation). If you have a minute to help me understand better I'd be grateful!
CRC_3_GSM = spec(3, 0x03, 0x00, false, false, 0x07, 0x04)
CRC_3_ROHC = spec(3, 0x03, 0x07, true, true, 0x00, 0x06)
CRC_4_G_704 = spec(4, 0x03, 0x00, true, true, 0x00, 0x07)
CRC_4_INTERLAKEN = spec(4, 0x03, 0x0f, false, false, 0x0f, 0x0b)
CRC_5_EPC_C1G2 = spec(5, 0x09, 0x09, false, false, 0x00, 0x00)
CRC_5_G_704 = spec(5, 0x15, 0x00, true, true, 0x00, 0x07)
CRC_5_USB = spec(5, 0x05, 0x1f, true, true, 0x1f, 0x19)
CRC_6_CDMA2000_A = spec(6, 0x27, 0x3f, false, false, 0x00, 0x0d)
CRC_6_CDMA2000_B = spec(6, 0x07, 0x3f, false, false, 0x00, 0x3b)
CRC_6_DARC = spec(6, 0x19, 0x00, true, true, 0x00, 0x26)
CRC_6_G_704 = spec(6, 0x03, 0x00, true, true, 0x00, 0x06)
CRC_6_GSM = spec(6, 0x2f, 0x00, false, false, 0x3f, 0x13)
CRC_7_MMC = spec(7, 0x09, 0x00, false, false, 0x00, 0x75)
CRC_7_ROHC = spec(7, 0x4f, 0x7f, true, true, 0x00, 0x53)
CRC_7_UMTS = spec(7, 0x45, 0x00, false, false, 0x00, 0x61)
CRC_8_AUTOSAR = spec(8, 0x2f, 0xff, false, false, 0xff, 0xdf)
CRC_8_BLUETOOTH = spec(8, 0xa7, 0x00, true, true, 0x00, 0x26)
CRC_8_CDMA2000 = spec(8, 0x9b, 0xff, false, false, 0x00, 0xda)
CRC_8_DARC = spec(8, 0x39, 0x00, true, true, 0x00, 0x15)
CRC_8_DVB_S2 = spec(8, 0xd5, 0x00, false, false, 0x00, 0xbc)
CRC_8_GSM_A = spec(8, 0x1d, 0x00, false, false, 0x00, 0x37)
CRC_8_GSM_B = spec(8, 0x49, 0x00, false, false, 0xff, 0x94)
CRC_8_HITAG = spec(8, 0x1d, 0xff, false, false, 0x00, 0xb4)
CRC_8_I_432_1 = spec(8, 0x07, 0x00, false, false, 0x55, 0xa1)
CRC_8_I_CODE = spec(8, 0x1d, 0xfd, false, false, 0x00, 0x7e)
CRC_8_LTE = spec(8, 0x9b, 0x00, false, false, 0x00, 0xea)
CRC_8_MAXIM_DOW = spec(8, 0x31, 0x00, true, true, 0x00, 0xa1)
CRC_8_MIFARE_MAD = spec(8, 0x1d, 0xc7, false, false, 0x00, 0x99)
CRC_8_NRSC_5 = spec(8, 0x31, 0xff, false, false, 0x00, 0xf7)
CRC_8_OPENSAFETY = spec(8, 0x2f, 0x00, false, false, 0x00, 0x3e)
CRC_8_ROHC = spec(8, 0x07, 0xff, true, true, 0x00, 0xd0)
CRC_8_SAE_J1850 = spec(8, 0x1d, 0xff, false, false, 0xff, 0x4b)
CRC_8_SMBUS = spec(8, 0x07, 0x00, false, false, 0x00, 0xf4)
CRC_8_TECH_3250 = spec(8, 0x1d, 0xff, true, true, 0x00, 0x97)
CRC_8_WCDMA = spec(8, 0x9b, 0x00, true, true, 0x00, 0x25)
CRC_10_ATM = spec(10, 0x0233, 0x00, false, false, 0x00, 0x0199)
CRC_10_CDMA2000 = spec(10, 0x03d9, 0x03ff, false, false, 0x00, 0x0233)
CRC_10_GSM = spec(10, 0x0175, 0x00, false, false, 0x03ff, 0x012a)
CRC_11_FLEXRAY = spec(11, 0x0385, 0x1a, false, false, 0x00, 0x05a3)
CRC_11_UMTS = spec(11, 0x0307, 0x00, false, false, 0x00, 0x61)
CRC_12_CDMA2000 = spec(12, 0x0f13, 0x0fff, false, false, 0x00, 0x0d4d)
CRC_12_DECT = spec(12, 0x080f, 0x00, false, false, 0x00, 0x0f5b)
CRC_12_GSM = spec(12, 0x0d31, 0x00, false, false, 0x0fff, 0x0b34)
CRC_12_UMTS = spec(12, 0x080f, 0x00, false, true, 0x00, 0x0daf)
CRC_13_BBC = spec(13, 0x1cf5, 0x00, false, false, 0x00, 0x04fa)
CRC_14_DARC = spec(14, 0x0805, 0x00, true, true, 0x00, 0x082d)
CRC_14_GSM = spec(14, 0x202d, 0x00, false, false, 0x3fff, 0x30ae)
CRC_15_CAN = spec(15, 0x4599, 0x00, false, false, 0x00, 0x059e)
CRC_15_MPT1327 = spec(15, 0x6815, 0x00, false, false, 0x01, 0x2566)
CRC_16_ARC = spec(16, 0x8005, 0x00, true, true, 0x00, 0xbb3d)
CRC_16_CDMA2000 = spec(16, 0xc867, 0xffff, false, false, 0x00, 0x4c06)
CRC_16_CMS = spec(16, 0x8005, 0xffff, false, false, 0x00, 0xaee7)
CRC_16_DDS_110 = spec(16, 0x8005, 0x800d, false, false, 0x00, 0x9ecf)
CRC_16_DECT_R = spec(16, 0x0589, 0x00, false, false, 0x01, 0x7e)
CRC_16_DECT_X = spec(16, 0x0589, 0x00, false, false, 0x00, 0x7f)
CRC_16_DNP = spec(16, 0x3d65, 0x00, true, true, 0xffff, 0xea82)
CRC_16_EN_13757 = spec(16, 0x3d65, 0x00, false, false, 0xffff, 0xc2b7)
CRC_16_GENIBUS = spec(16, 0x1021, 0xffff, false, false, 0xffff, 0xd64e)
CRC_16_GSM = spec(16, 0x1021, 0x00, false, false, 0xffff, 0xce3c)
CRC_16_IBM_3740 = spec(16, 0x1021, 0xffff, false, false, 0x00, 0x29b1)
CRC_16_IBM_SDLC = spec(16, 0x1021, 0xffff, true, true, 0xffff, 0x906e)
CRC_16_ISO_IEC_14443_3_A = spec(16, 0x1021, 0xc6c6, true, true, 0x00, 0xbf05)
CRC_16_KERMIT = spec(16, 0x1021, 0x00, true, true, 0x00, 0x2189)
CRC_16_LJ1200 = spec(16, 0x6f63, 0x00, false, false, 0x00, 0xbdf4)
CRC_16_M17 = spec(16, 0x5935, 0xffff, false, false, 0x00, 0x772b)
CRC_16_MAXIM_DOW = spec(16, 0x8005, 0x00, true, true, 0xffff, 0x44c2)
CRC_16_MCRF4XX = spec(16, 0x1021, 0xffff, true, true, 0x00, 0x6f91)
CRC_16_MODBUS = spec(16, 0x8005, 0xffff, true, true, 0x00, 0x4b37)
CRC_16_NRSC_5 = spec(16, 0x080b, 0xffff, true, true, 0x00, 0xa066)
CRC_16_OPENSAFETY_A = spec(16, 0x5935, 0x00, false, false, 0x00, 0x5d38)
CRC_16_OPENSAFETY_B = spec(16, 0x755b, 0x00, false, false, 0x00, 0x20fe)
CRC_16_PROFIBUS = spec(16, 0x1dcf, 0xffff, false, false, 0xffff, 0xa819)
CRC_16_RIELLO = spec(16, 0x1021, 0xb2aa, true, true, 0x00, 0x63d0)
CRC_16_SPI_FUJITSU = spec(16, 0x1021, 0x1d0f, false, false, 0x00, 0xe5cc)
CRC_16_T10_DIF = spec(16, 0x8bb7, 0x00, false, false, 0x00, 0xd0db)
CRC_16_TELEDISK = spec(16, 0xa097, 0x00, false, false, 0x00, 0x0fb3)
CRC_16_TMS37157 = spec(16, 0x1021, 0x89ec, true, true, 0x00, 0x26b1)
CRC_16_UMTS = spec(16, 0x8005, 0x00, false, false, 0x00, 0xfee8)
CRC_16_USB = spec(16, 0x8005, 0xffff, true, true, 0xffff, 0xb4c8)
CRC_16_XMODEM = spec(16, 0x1021, 0x00, false, false, 0x00, 0x31c3)
CRC_17_CAN_FD = spec(17, 0x0001685b, 0x00, false, false, 0x00, 0x4f03)
CRC_21_CAN_FD = spec(21, 0x00102899, 0x00, false, false, 0x00, 0x000ed841)
CRC_24_BLE = spec(24, 0x065b, 0x00555555, true, true, 0x00, 0x00c25a56)
CRC_24_FLEXRAY_A = spec(24, 0x005d6dcb, 0x00fedcba, false, false, 0x00, 0x007979bd)
CRC_24_FLEXRAY_B = spec(24, 0x005d6dcb, 0x00abcdef, false, false, 0x00, 0x001f23b8)
CRC_24_INTERLAKEN = spec(24, 0x00328b63, 0x00ffffff, false, false, 0x00ffffff, 0x00b4f3e6)
CRC_24_LTE_A = spec(24, 0x00864cfb, 0x00, false, false, 0x00, 0x00cde703)
CRC_24_LTE_B = spec(24, 0x00800063, 0x00, false, false, 0x00, 0x0023ef52)
CRC_24_OPENPGP = spec(24, 0x00864cfb, 0x00b704ce, false, false, 0x00, 0x0021cf02)
CRC_24_OS_9 = spec(24, 0x00800063, 0x00ffffff, false, false, 0x00ffffff, 0x00200fa5)
CRC_30_CDMA = spec(30, 0x2030b9c7, 0x3fffffff, false, false, 0x3fffffff, 0x04c34abf)
CRC_31_PHILIPS = spec(31, 0x04c11db7, 0x7fffffff, false, false, 0x7fffffff, 0x0ce9e46c)
CRC_32_AIXM = spec(32, 0x814141ab, 0x00, false, false, 0x00, 0x3010bf7f)
CRC_32_AUTOSAR = spec(32, 0xf4acfb13, 0xffffffff, true, true, 0xffffffff, 0x1697d06a)
CRC_32_BASE91_D = spec(32, 0xa833982b, 0xffffffff, true, true, 0xffffffff, 0x87315576)
CRC_32_BZIP2 = spec(32, 0x04c11db7, 0xffffffff, false, false, 0xffffffff, 0xfc891918)
CRC_32_CD_ROM_EDC = spec(32, 0x8001801b, 0x00, true, true, 0x00, 0x6ec2edc4)
CRC_32_CKSUM = spec(32, 0x04c11db7, 0x00, false, false, 0xffffffff, 0x765e7680)
CRC_32_ISCSI = spec(32, 0x1edc6f41, 0xffffffff, true, true, 0xffffffff, 0xe3069283)
CRC_32_ISO_HDLC = spec(32, 0x04c11db7, 0xffffffff, true, true, 0xffffffff, 0xcbf43926)
CRC_32_JAMCRC = spec(32, 0x04c11db7, 0xffffffff, true, true, 0x00, 0x340bc6d9)
CRC_32_MEF = spec(32, 0x741b8cd7, 0xffffffff, true, true, 0x00, 0xd2c22f51)
CRC_32_MPEG_2 = spec(32, 0x04c11db7, 0xffffffff, false, false, 0x00, 0x0376e6e7)
CRC_32_XFER = spec(32, 0xaf, 0x00, false, false, 0x00, 0xbd0be338)
CRC_40_GSM = spec(40, 0x04820009, 0x00, false, false, 0x000000ffffffffff, 0x000000d4164fc646)
CRC_64_ECMA_182 = spec(64, 0x42f0e1eba9ea3693, 0x00, false, false, 0x00, 0x6c40df5f0b497347)
CRC_64_GO_ISO = spec(64, 0x1b, 0xffffffffffffffff, true, true, 0xffffffffffffffff, 0xb90956c775a41001)
CRC_64_MS = spec(64, 0x259c84cba6426349, 0xffffffffffffffff, true, true, 0x00, 0x75d4b74f024eceea)
CRC_64_REDIS = spec(64, 0xad93d23594c935a9, 0x00, true, true, 0x00, 0xe9c6d914c4b8d9ca)
CRC_64_WE = spec(64, 0x42f0e1eba9ea3693, 0xffffffffffffffff, false, false, 0xffffffffffffffff, 0x62ec59e3f1a4f00a)
CRC_64_XZ = spec(64, 0x42f0e1eba9ea3693, 0xffffffffffffffff, true, true, 0xffffffffffffffff, 0x995dc9bbdf1939fa)
CRC_82_DARC = spec(82, 0x000000000000308c0111011401440411, 0x00, true, true, 0x00, 0x0000000000009ea83f625023801fd612)
const ALL = Dict{Symbol,Spec}(
:CRC_3_GSM => CRC_3_GSM,
:CRC_3_ROHC => CRC_3_ROHC,
:CRC_4_G_704 => CRC_4_G_704,
:CRC_4_INTERLAKEN => CRC_4_INTERLAKEN,
:CRC_5_EPC_C1G2 => CRC_5_EPC_C1G2,
:CRC_5_G_704 => CRC_5_G_704,
:CRC_5_USB => CRC_5_USB,
:CRC_6_CDMA2000_A => CRC_6_CDMA2000_A,
:CRC_6_CDMA2000_B => CRC_6_CDMA2000_B,
:CRC_6_DARC => CRC_6_DARC,
:CRC_6_G_704 => CRC_6_G_704,
:CRC_6_GSM => CRC_6_GSM,
:CRC_7_MMC => CRC_7_MMC,
:CRC_7_ROHC => CRC_7_ROHC,
:CRC_7_UMTS => CRC_7_UMTS,
:CRC_8_AUTOSAR => CRC_8_AUTOSAR,
:CRC_8_BLUETOOTH => CRC_8_BLUETOOTH,
:CRC_8_CDMA2000 => CRC_8_CDMA2000,
:CRC_8_DARC => CRC_8_DARC,
:CRC_8_DVB_S2 => CRC_8_DVB_S2,
:CRC_8_GSM_A => CRC_8_GSM_A,
:CRC_8_GSM_B => CRC_8_GSM_B,
:CRC_8_HITAG => CRC_8_HITAG,
:CRC_8_I_432_1 => CRC_8_I_432_1,
:CRC_8_I_CODE => CRC_8_I_CODE,
:CRC_8_LTE => CRC_8_LTE,
:CRC_8_MAXIM_DOW => CRC_8_MAXIM_DOW,
:CRC_8_MIFARE_MAD => CRC_8_MIFARE_MAD,
:CRC_8_NRSC_5 => CRC_8_NRSC_5,
:CRC_8_OPENSAFETY => CRC_8_OPENSAFETY,
:CRC_8_ROHC => CRC_8_ROHC,
:CRC_8_SAE_J1850 => CRC_8_SAE_J1850,
:CRC_8_SMBUS => CRC_8_SMBUS,
:CRC_8_TECH_3250 => CRC_8_TECH_3250,
:CRC_8_WCDMA => CRC_8_WCDMA,
:CRC_10_ATM => CRC_10_ATM,
:CRC_10_CDMA2000 => CRC_10_CDMA2000,
:CRC_10_GSM => CRC_10_GSM,
:CRC_11_FLEXRAY => CRC_11_FLEXRAY,
:CRC_11_UMTS => CRC_11_UMTS,
:CRC_12_CDMA2000 => CRC_12_CDMA2000,
:CRC_12_DECT => CRC_12_DECT,
:CRC_12_GSM => CRC_12_GSM,
:CRC_12_UMTS => CRC_12_UMTS,
:CRC_13_BBC => CRC_13_BBC,
:CRC_14_DARC => CRC_14_DARC,
:CRC_14_GSM => CRC_14_GSM,
:CRC_15_CAN => CRC_15_CAN,
:CRC_15_MPT1327 => CRC_15_MPT1327,
:CRC_16_ARC => CRC_16_ARC,
:CRC_16_CDMA2000 => CRC_16_CDMA2000,
:CRC_16_CMS => CRC_16_CMS,
:CRC_16_DDS_110 => CRC_16_DDS_110,
:CRC_16_DECT_R => CRC_16_DECT_R,
:CRC_16_DECT_X => CRC_16_DECT_X,
:CRC_16_DNP => CRC_16_DNP,
:CRC_16_EN_13757 => CRC_16_EN_13757,
:CRC_16_GENIBUS => CRC_16_GENIBUS,
:CRC_16_GSM => CRC_16_GSM,
:CRC_16_IBM_3740 => CRC_16_IBM_3740,
:CRC_16_IBM_SDLC => CRC_16_IBM_SDLC,
:CRC_16_ISO_IEC_14443_3_A => CRC_16_ISO_IEC_14443_3_A,
:CRC_16_KERMIT => CRC_16_KERMIT,
:CRC_16_LJ1200 => CRC_16_LJ1200,
:CRC_16_M17 => CRC_16_M17,
:CRC_16_MAXIM_DOW => CRC_16_MAXIM_DOW,
:CRC_16_MCRF4XX => CRC_16_MCRF4XX,
:CRC_16_MODBUS => CRC_16_MODBUS,
:CRC_16_NRSC_5 => CRC_16_NRSC_5,
:CRC_16_OPENSAFETY_A => CRC_16_OPENSAFETY_A,
:CRC_16_OPENSAFETY_B => CRC_16_OPENSAFETY_B,
:CRC_16_PROFIBUS => CRC_16_PROFIBUS,
:CRC_16_RIELLO => CRC_16_RIELLO,
:CRC_16_SPI_FUJITSU => CRC_16_SPI_FUJITSU,
:CRC_16_T10_DIF => CRC_16_T10_DIF,
:CRC_16_TELEDISK => CRC_16_TELEDISK,
:CRC_16_TMS37157 => CRC_16_TMS37157,
:CRC_16_UMTS => CRC_16_UMTS,
:CRC_16_USB => CRC_16_USB,
:CRC_16_XMODEM => CRC_16_XMODEM,
:CRC_17_CAN_FD => CRC_17_CAN_FD,
:CRC_21_CAN_FD => CRC_21_CAN_FD,
:CRC_24_BLE => CRC_24_BLE,
:CRC_24_FLEXRAY_A => CRC_24_FLEXRAY_A,
:CRC_24_FLEXRAY_B => CRC_24_FLEXRAY_B,
:CRC_24_INTERLAKEN => CRC_24_INTERLAKEN,
:CRC_24_LTE_A => CRC_24_LTE_A,
:CRC_24_LTE_B => CRC_24_LTE_B,
:CRC_24_OPENPGP => CRC_24_OPENPGP,
:CRC_24_OS_9 => CRC_24_OS_9,
:CRC_30_CDMA => CRC_30_CDMA,
:CRC_31_PHILIPS => CRC_31_PHILIPS,
:CRC_32_AIXM => CRC_32_AIXM,
:CRC_32_AUTOSAR => CRC_32_AUTOSAR,
:CRC_32_BASE91_D => CRC_32_BASE91_D,
:CRC_32_BZIP2 => CRC_32_BZIP2,
:CRC_32_CD_ROM_EDC => CRC_32_CD_ROM_EDC,
:CRC_32_CKSUM => CRC_32_CKSUM,
:CRC_32_ISCSI => CRC_32_ISCSI,
:CRC_32_ISO_HDLC => CRC_32_ISO_HDLC,
:CRC_32_JAMCRC => CRC_32_JAMCRC,
:CRC_32_MEF => CRC_32_MEF,
:CRC_32_MPEG_2 => CRC_32_MPEG_2,
:CRC_32_XFER => CRC_32_XFER,
:CRC_40_GSM => CRC_40_GSM,
:CRC_64_ECMA_182 => CRC_64_ECMA_182,
:CRC_64_GO_ISO => CRC_64_GO_ISO,
:CRC_64_MS => CRC_64_MS,
:CRC_64_REDIS => CRC_64_REDIS,
:CRC_64_WE => CRC_64_WE,
:CRC_64_XZ => CRC_64_XZ,
:CRC_82_DARC => CRC_82_DARC,
)