Debian Codegraph @

debian/rust-vendor/crc-fast/src/crc16/consts.rs

raw
1 // Copyright 2025 Don MacAskill. Licensed under MIT or Apache-2.0.
2
3 #![allow(dead_code)]
4
5 use crate::consts::{
6 NAME_CRC16_ARC, NAME_CRC16_CDMA2000, NAME_CRC16_CMS, NAME_CRC16_DDS_110, NAME_CRC16_DECT_R,
7 NAME_CRC16_DECT_X, NAME_CRC16_DNP, NAME_CRC16_EN_13757, NAME_CRC16_GENIBUS, NAME_CRC16_GSM,
8 NAME_CRC16_IBM_3740, NAME_CRC16_IBM_SDLC, NAME_CRC16_ISO_IEC_14443_3_A, NAME_CRC16_KERMIT,
9 NAME_CRC16_LJ1200, NAME_CRC16_M17, NAME_CRC16_MAXIM_DOW, NAME_CRC16_MCRF4XX, NAME_CRC16_MODBUS,
10 NAME_CRC16_NRSC_5, NAME_CRC16_OPENSAFETY_A, NAME_CRC16_OPENSAFETY_B, NAME_CRC16_PROFIBUS,
11 NAME_CRC16_RIELLO, NAME_CRC16_SPI_FUJITSU, NAME_CRC16_T10_DIF, NAME_CRC16_TELEDISK,
12 NAME_CRC16_TMS37157, NAME_CRC16_UMTS, NAME_CRC16_USB, NAME_CRC16_XMODEM,
13 };
14 use crate::CrcAlgorithm;
15 use crate::CrcParams;
16 use crc::{
17 CRC_16_ARC, CRC_16_CDMA2000, CRC_16_CMS, CRC_16_DDS_110, CRC_16_DECT_R, CRC_16_DECT_X,
18 CRC_16_DNP, CRC_16_EN_13757, CRC_16_GENIBUS, CRC_16_GSM, CRC_16_IBM_3740, CRC_16_IBM_SDLC,
19 CRC_16_ISO_IEC_14443_3_A, CRC_16_KERMIT, CRC_16_LJ1200, CRC_16_M17, CRC_16_MAXIM_DOW,
20 CRC_16_MCRF4XX, CRC_16_MODBUS, CRC_16_NRSC_5, CRC_16_OPENSAFETY_A, CRC_16_OPENSAFETY_B,
21 CRC_16_PROFIBUS, CRC_16_RIELLO, CRC_16_SPI_FUJITSU, CRC_16_T10_DIF, CRC_16_TELEDISK,
22 CRC_16_TMS37157, CRC_16_UMTS, CRC_16_USB, CRC_16_XMODEM,
23 };
24
25 // width=16 poly=0x8005 init=0x0000 refin=true refout=true xorout=0x0000 check=0xbb3d residue=0x0000 name="CRC-16/ARC"
26 pub const CRC16_ARC: CrcParams = CrcParams {
27 name: NAME_CRC16_ARC,
28 algorithm: CrcAlgorithm::Crc16Arc,
29 width: 16,
30 poly: CRC_16_ARC.poly as u64,
31 init: CRC_16_ARC.init as u64,
32 init_algorithm: CRC_16_ARC.init as u64, // 0x0000 is symmetric under bit-reversal
33 refin: CRC_16_ARC.refin,
34 refout: CRC_16_ARC.refout,
35 xorout: CRC_16_ARC.xorout as u64,
36 check: CRC_16_ARC.check as u64,
37 keys: crate::CrcKeysStorage::from_keys_fold_256(KEYS_8005_REFLECTED),
38 };
39
40 // width=16 poly=0xc867 init=0xffff refin=false refout=false xorout=0x0000 check=0x4c06 residue=0x0000 name="CRC-16/CDMA2000"
41 pub const CRC16_CDMA2000: CrcParams = CrcParams {
42 name: NAME_CRC16_CDMA2000,
43 algorithm: CrcAlgorithm::Crc16Cdma2000,
44 width: 16,
45 poly: CRC_16_CDMA2000.poly as u64,
46 init: CRC_16_CDMA2000.init as u64,
47 init_algorithm: CRC_16_CDMA2000.init as u64,
48 refin: CRC_16_CDMA2000.refin,
49 refout: CRC_16_CDMA2000.refout,
50 xorout: CRC_16_CDMA2000.xorout as u64,
51 check: CRC_16_CDMA2000.check as u64,
52 keys: crate::CrcKeysStorage::from_keys_fold_256(KEYS_C867_FORWARD),
53 };
54
55 // width=16 poly=0x8005 init=0xffff refin=false refout=false xorout=0x0000 check=0xaee7 residue=0x0000 name="CRC-16/CMS"
56 pub const CRC16_CMS: CrcParams = CrcParams {
57 name: NAME_CRC16_CMS,
58 algorithm: CrcAlgorithm::Crc16Cms,
59 width: 16,
60 poly: CRC_16_CMS.poly as u64,
61 init: CRC_16_CMS.init as u64,
62 init_algorithm: CRC_16_CMS.init as u64,
63 refin: CRC_16_CMS.refin,
64 refout: CRC_16_CMS.refout,
65 xorout: CRC_16_CMS.xorout as u64,
66 check: CRC_16_CMS.check as u64,
67 keys: crate::CrcKeysStorage::from_keys_fold_256(KEYS_8005_FORWARD),
68 };
69
70 // width=16 poly=0x8005 init=0x800d refin=false refout=false xorout=0x0000 check=0x9ecf residue=0x0000 name="CRC-16/DDS-110"
71 pub const CRC16_DDS_110: CrcParams = CrcParams {
72 name: NAME_CRC16_DDS_110,
73 algorithm: CrcAlgorithm::Crc16Dds110,
74 width: 16,
75 poly: CRC_16_DDS_110.poly as u64,
76 init: CRC_16_DDS_110.init as u64,
77 init_algorithm: CRC_16_DDS_110.init as u64,
78 refin: CRC_16_DDS_110.refin,
79 refout: CRC_16_DDS_110.refout,
80 xorout: CRC_16_DDS_110.xorout as u64,
81 check: CRC_16_DDS_110.check as u64,
82 keys: crate::CrcKeysStorage::from_keys_fold_256(KEYS_8005_FORWARD),
83 };
84
85 // width=16 poly=0x0589 init=0x0000 refin=false refout=false xorout=0x0001 check=0x007e residue=0x0589 name="CRC-16/DECT-R"
86 pub const CRC16_DECT_R: CrcParams = CrcParams {
87 name: NAME_CRC16_DECT_R,
88 algorithm: CrcAlgorithm::Crc16DectR,
89 width: 16,
90 poly: CRC_16_DECT_R.poly as u64,
91 init: CRC_16_DECT_R.init as u64,
92 init_algorithm: CRC_16_DECT_R.init as u64,
93 refin: CRC_16_DECT_R.refin,
94 refout: CRC_16_DECT_R.refout,
95 xorout: CRC_16_DECT_R.xorout as u64,
96 check: CRC_16_DECT_R.check as u64,
97 keys: crate::CrcKeysStorage::from_keys_fold_256(KEYS_0589_FORWARD),
98 };
99
100 // width=16 poly=0x0589 init=0x0000 refin=false refout=false xorout=0x0000 check=0x007f residue=0x0000 name="CRC-16/DECT-X"
101 pub const CRC16_DECT_X: CrcParams = CrcParams {
102 name: NAME_CRC16_DECT_X,
103 algorithm: CrcAlgorithm::Crc16DectX,
104 width: 16,
105 poly: CRC_16_DECT_X.poly as u64,
106 init: CRC_16_DECT_X.init as u64,
107 init_algorithm: CRC_16_DECT_X.init as u64,
108 refin: CRC_16_DECT_X.refin,
109 refout: CRC_16_DECT_X.refout,
110 xorout: CRC_16_DECT_X.xorout as u64,
111 check: CRC_16_DECT_X.check as u64,
112 keys: crate::CrcKeysStorage::from_keys_fold_256(KEYS_0589_FORWARD),
113 };
114
115 // width=16 poly=0x3d65 init=0x0000 refin=true refout=true xorout=0xffff check=0xea82 residue=0x66c5 name="CRC-16/DNP"
116 pub const CRC16_DNP: CrcParams = CrcParams {
117 name: NAME_CRC16_DNP,
118 algorithm: CrcAlgorithm::Crc16Dnp,
119 width: 16,
120 poly: CRC_16_DNP.poly as u64,
121 init: CRC_16_DNP.init as u64,
122 init_algorithm: CRC_16_DNP.init as u64, // 0x0000 is symmetric under bit-reversal
123 refin: CRC_16_DNP.refin,
124 refout: CRC_16_DNP.refout,
125 xorout: CRC_16_DNP.xorout as u64,
126 check: CRC_16_DNP.check as u64,
127 keys: crate::CrcKeysStorage::from_keys_fold_256(KEYS_3D65_REFLECTED),
128 };
129
130 // width=16 poly=0x3d65 init=0x0000 refin=false refout=false xorout=0xffff check=0xc2b7 residue=0xa366 name="CRC-16/EN-13757"
131 pub const CRC16_EN_13757: CrcParams = CrcParams {
132 name: NAME_CRC16_EN_13757,
133 algorithm: CrcAlgorithm::Crc16En13757,
134 width: 16,
135 poly: CRC_16_EN_13757.poly as u64,
136 init: CRC_16_EN_13757.init as u64,
137 init_algorithm: CRC_16_EN_13757.init as u64,
138 refin: CRC_16_EN_13757.refin,
139 refout: CRC_16_EN_13757.refout,
140 xorout: CRC_16_EN_13757.xorout as u64,
141 check: CRC_16_EN_13757.check as u64,
142 keys: crate::CrcKeysStorage::from_keys_fold_256(KEYS_3D65_FORWARD),
143 };
144
145 // width=16 poly=0x1021 init=0xffff refin=false refout=false xorout=0xffff check=0xd64e residue=0x1d0f name="CRC-16/GENIBUS"
146 pub const CRC16_GENIBUS: CrcParams = CrcParams {
147 name: NAME_CRC16_GENIBUS,
148 algorithm: CrcAlgorithm::Crc16Genibus,
149 width: 16,
150 poly: CRC_16_GENIBUS.poly as u64,
151 init: CRC_16_GENIBUS.init as u64,
152 init_algorithm: CRC_16_GENIBUS.init as u64,
153 refin: CRC_16_GENIBUS.refin,
154 refout: CRC_16_GENIBUS.refout,
155 xorout: CRC_16_GENIBUS.xorout as u64,
156 check: CRC_16_GENIBUS.check as u64,
157 keys: crate::CrcKeysStorage::from_keys_fold_256(KEYS_1021_FORWARD),
158 };
159
160 // width=16 poly=0x1021 init=0x0000 refin=false refout=false xorout=0xffff check=0xce3c residue=0x1d0f name="CRC-16/GSM"
161 pub const CRC16_GSM: CrcParams = CrcParams {
162 name: NAME_CRC16_GSM,
163 algorithm: CrcAlgorithm::Crc16Gsm,
164 width: 16,
165 poly: CRC_16_GSM.poly as u64,
166 init: CRC_16_GSM.init as u64,
167 init_algorithm: CRC_16_GSM.init as u64,
168 refin: CRC_16_GSM.refin,
169 refout: CRC_16_GSM.refout,
170 xorout: CRC_16_GSM.xorout as u64,
171 check: CRC_16_GSM.check as u64,
172 keys: crate::CrcKeysStorage::from_keys_fold_256(KEYS_1021_FORWARD),
173 };
174
175 // width=16 poly=0x1021 init=0xffff refin=false refout=false xorout=0x0000 check=0x29b1 residue=0x0000 name="CRC-16/IBM-3740"
176 pub const CRC16_IBM_3740: CrcParams = CrcParams {
177 name: NAME_CRC16_IBM_3740,
178 algorithm: CrcAlgorithm::Crc16Ibm3740,
179 width: 16,
180 poly: CRC_16_IBM_3740.poly as u64,
181 init: CRC_16_IBM_3740.init as u64,
182 init_algorithm: CRC_16_IBM_3740.init as u64,
183 refin: CRC_16_IBM_3740.refin,
184 refout: CRC_16_IBM_3740.refout,
185 xorout: CRC_16_IBM_3740.xorout as u64,
186 check: CRC_16_IBM_3740.check as u64,
187 keys: crate::CrcKeysStorage::from_keys_fold_256(KEYS_1021_FORWARD),
188 };
189
190 // width=16 poly=0x1021 init=0xffff refin=true refout=true xorout=0xffff check=0x906e residue=0xf0b8 name="CRC-16/IBM-SDLC"
191 pub const CRC16_IBM_SDLC: CrcParams = CrcParams {
192 name: NAME_CRC16_IBM_SDLC,
193 algorithm: CrcAlgorithm::Crc16IbmSdlc,
194 width: 16,
195 poly: CRC_16_IBM_SDLC.poly as u64,
196 init: CRC_16_IBM_SDLC.init as u64,
197 init_algorithm: CRC_16_IBM_SDLC.init as u64, // 0xFFFF is symmetric under bit-reversal
198 refin: CRC_16_IBM_SDLC.refin,
199 refout: CRC_16_IBM_SDLC.refout,
200 xorout: CRC_16_IBM_SDLC.xorout as u64,
201 check: CRC_16_IBM_SDLC.check as u64,
202 keys: crate::CrcKeysStorage::from_keys_fold_256(KEYS_1021_REVERSE),
203 };
204
205 // width=16 poly=0x1021 init=0xc6c6 refin=true refout=true xorout=0x0000 check=0xbf05 residue=0x0000 name="CRC-16/ISO-IEC-14443-3-A"
206 pub const CRC16_ISO_IEC_14443_3_A: CrcParams = CrcParams {
207 name: NAME_CRC16_ISO_IEC_14443_3_A,
208 algorithm: CrcAlgorithm::Crc16IsoIec144433A,
209 width: 16,
210 poly: CRC_16_ISO_IEC_14443_3_A.poly as u64,
211 init: CRC_16_ISO_IEC_14443_3_A.init as u64,
212 // 0xC6C6 bit-reversed = 0x6363; pre-computed to avoid runtime reversal
213 init_algorithm: 0x6363,
214 refin: CRC_16_ISO_IEC_14443_3_A.refin,
215 refout: CRC_16_ISO_IEC_14443_3_A.refout,
216 xorout: CRC_16_ISO_IEC_14443_3_A.xorout as u64,
217 check: CRC_16_ISO_IEC_14443_3_A.check as u64,
218 keys: crate::CrcKeysStorage::from_keys_fold_256(KEYS_1021_REVERSE),
219 };
220
221 // width=16 poly=0x1021 init=0x0000 refin=true refout=true xorout=0x0000 check=0x2189 residue=0x0000 name="CRC-16/KERMIT"
222 pub const CRC16_KERMIT: CrcParams = CrcParams {
223 name: NAME_CRC16_KERMIT,
224 algorithm: CrcAlgorithm::Crc16Kermit,
225 width: 16,
226 poly: CRC_16_KERMIT.poly as u64,
227 init: CRC_16_KERMIT.init as u64,
228 init_algorithm: CRC_16_KERMIT.init as u64, // 0x0000 is symmetric under bit-reversal
229 refin: CRC_16_KERMIT.refin,
230 refout: CRC_16_KERMIT.refout,
231 xorout: CRC_16_KERMIT.xorout as u64,
232 check: CRC_16_KERMIT.check as u64,
233 keys: crate::CrcKeysStorage::from_keys_fold_256(KEYS_1021_REVERSE),
234 };
235
236 // width=16 poly=0x6f63 init=0x0000 refin=false refout=false xorout=0x0000 check=0xbdf4 residue=0x0000 name="CRC-16/LJ1200"
237 pub const CRC16_LJ1200: CrcParams = CrcParams {
238 name: NAME_CRC16_LJ1200,
239 algorithm: CrcAlgorithm::Crc16Lj1200,
240 width: 16,
241 poly: CRC_16_LJ1200.poly as u64,
242 init: CRC_16_LJ1200.init as u64,
243 init_algorithm: CRC_16_LJ1200.init as u64,
244 refin: CRC_16_LJ1200.refin,
245 refout: CRC_16_LJ1200.refout,
246 xorout: CRC_16_LJ1200.xorout as u64,
247 check: CRC_16_LJ1200.check as u64,
248 keys: crate::CrcKeysStorage::from_keys_fold_256(KEYS_6F63_FORWARD),
249 };
250
251 // width=16 poly=0x5935 init=0xffff refin=false refout=false xorout=0x0000 check=0x772b residue=0x0000 name="CRC-16/M17"
252 pub const CRC16_M17: CrcParams = CrcParams {
253 name: NAME_CRC16_M17,
254 algorithm: CrcAlgorithm::Crc16M17,
255 width: 16,
256 poly: CRC_16_M17.poly as u64,
257 init: CRC_16_M17.init as u64,
258 init_algorithm: CRC_16_M17.init as u64,
259 refin: CRC_16_M17.refin,
260 refout: CRC_16_M17.refout,
261 xorout: CRC_16_M17.xorout as u64,
262 check: CRC_16_M17.check as u64,
263 keys: crate::CrcKeysStorage::from_keys_fold_256(KEYS_5935_FORWARD),
264 };
265
266 // width=16 poly=0x8005 init=0x0000 refin=true refout=true xorout=0xffff check=0x44c2 residue=0xb001 name="CRC-16/MAXIM-DOW"
267 pub const CRC16_MAXIM_DOW: CrcParams = CrcParams {
268 name: NAME_CRC16_MAXIM_DOW,
269 algorithm: CrcAlgorithm::Crc16MaximDow,
270 width: 16,
271 poly: CRC_16_MAXIM_DOW.poly as u64,
272 init: CRC_16_MAXIM_DOW.init as u64,
273 init_algorithm: CRC_16_MAXIM_DOW.init as u64, // 0x0000 is symmetric under bit-reversal
274 refin: CRC_16_MAXIM_DOW.refin,
275 refout: CRC_16_MAXIM_DOW.refout,
276 xorout: CRC_16_MAXIM_DOW.xorout as u64,
277 check: CRC_16_MAXIM_DOW.check as u64,
278 keys: crate::CrcKeysStorage::from_keys_fold_256(KEYS_8005_REFLECTED),
279 };
280
281 // width=16 poly=0x1021 init=0xffff refin=true refout=true xorout=0x0000 check=0x6f91 residue=0x0000 name="CRC-16/MCRF4XX"
282 pub const CRC16_MCRF4XX: CrcParams = CrcParams {
283 name: NAME_CRC16_MCRF4XX,
284 algorithm: CrcAlgorithm::Crc16Mcrf4xx,
285 width: 16,
286 poly: CRC_16_MCRF4XX.poly as u64,
287 init: CRC_16_MCRF4XX.init as u64,
288 init_algorithm: CRC_16_MCRF4XX.init as u64, // 0xFFFF is symmetric under bit-reversal
289 refin: CRC_16_MCRF4XX.refin,
290 refout: CRC_16_MCRF4XX.refout,
291 xorout: CRC_16_MCRF4XX.xorout as u64,
292 check: CRC_16_MCRF4XX.check as u64,
293 keys: crate::CrcKeysStorage::from_keys_fold_256(KEYS_1021_REVERSE),
294 };
295
296 // width=16 poly=0x8005 init=0xffff refin=true refout=true xorout=0x0000 check=0x4b37 residue=0x0000 name="CRC-16/MODBUS"
297 pub const CRC16_MODBUS: CrcParams = CrcParams {
298 name: NAME_CRC16_MODBUS,
299 algorithm: CrcAlgorithm::Crc16Modbus,
300 width: 16,
301 poly: CRC_16_MODBUS.poly as u64,
302 init: CRC_16_MODBUS.init as u64,
303 init_algorithm: CRC_16_MODBUS.init as u64, // 0xFFFF is symmetric under bit-reversal
304 refin: CRC_16_MODBUS.refin,
305 refout: CRC_16_MODBUS.refout,
306 xorout: CRC_16_MODBUS.xorout as u64,
307 check: CRC_16_MODBUS.check as u64,
308 keys: crate::CrcKeysStorage::from_keys_fold_256(KEYS_8005_REFLECTED),
309 };
310
311 // width=16 poly=0x080b init=0xffff refin=true refout=true xorout=0x0000 check=0xa066 residue=0x0000 name="CRC-16/NRSC-5"
312 pub const CRC16_NRSC_5: CrcParams = CrcParams {
313 name: NAME_CRC16_NRSC_5,
314 algorithm: CrcAlgorithm::Crc16Nrsc5,
315 width: 16,
316 poly: CRC_16_NRSC_5.poly as u64,
317 init: CRC_16_NRSC_5.init as u64,
318 init_algorithm: CRC_16_NRSC_5.init as u64, // 0xFFFF is symmetric under bit-reversal
319 refin: CRC_16_NRSC_5.refin,
320 refout: CRC_16_NRSC_5.refout,
321 xorout: CRC_16_NRSC_5.xorout as u64,
322 check: CRC_16_NRSC_5.check as u64,
323 keys: crate::CrcKeysStorage::from_keys_fold_256(KEYS_080B_REFLECTED),
324 };
325
326 // width=16 poly=0x5935 init=0x0000 refin=false refout=false xorout=0x0000 check=0x5d38 residue=0x0000 name="CRC-16/OPENSAFETY-A"
327 pub const CRC16_OPENSAFETY_A: CrcParams = CrcParams {
328 name: NAME_CRC16_OPENSAFETY_A,
329 algorithm: CrcAlgorithm::Crc16OpensafetyA,
330 width: 16,
331 poly: CRC_16_OPENSAFETY_A.poly as u64,
332 init: CRC_16_OPENSAFETY_A.init as u64,
333 init_algorithm: CRC_16_OPENSAFETY_A.init as u64,
334 refin: CRC_16_OPENSAFETY_A.refin,
335 refout: CRC_16_OPENSAFETY_A.refout,
336 xorout: CRC_16_OPENSAFETY_A.xorout as u64,
337 check: CRC_16_OPENSAFETY_A.check as u64,
338 keys: crate::CrcKeysStorage::from_keys_fold_256(KEYS_5935_FORWARD),
339 };
340
341 // width=16 poly=0x755b init=0x0000 refin=false refout=false xorout=0x0000 check=0x20fe residue=0x0000 name="CRC-16/OPENSAFETY-B"
342 pub const CRC16_OPENSAFETY_B: CrcParams = CrcParams {
343 name: NAME_CRC16_OPENSAFETY_B,
344 algorithm: CrcAlgorithm::Crc16OpensafetyB,
345 width: 16,
346 poly: CRC_16_OPENSAFETY_B.poly as u64,
347 init: CRC_16_OPENSAFETY_B.init as u64,
348 init_algorithm: CRC_16_OPENSAFETY_B.init as u64,
349 refin: CRC_16_OPENSAFETY_B.refin,
350 refout: CRC_16_OPENSAFETY_B.refout,
351 xorout: CRC_16_OPENSAFETY_B.xorout as u64,
352 check: CRC_16_OPENSAFETY_B.check as u64,
353 keys: crate::CrcKeysStorage::from_keys_fold_256(KEYS_755B_FORWARD),
354 };
355
356 // width=16 poly=0x1dcf init=0xffff refin=false refout=false xorout=0xffff check=0xa819 residue=0xe394 name="CRC-16/PROFIBUS"
357 pub const CRC16_PROFIBUS: CrcParams = CrcParams {
358 name: NAME_CRC16_PROFIBUS,
359 algorithm: CrcAlgorithm::Crc16Profibus,
360 width: 16,
361 poly: CRC_16_PROFIBUS.poly as u64,
362 init: CRC_16_PROFIBUS.init as u64,
363 init_algorithm: CRC_16_PROFIBUS.init as u64,
364 refin: CRC_16_PROFIBUS.refin,
365 refout: CRC_16_PROFIBUS.refout,
366 xorout: CRC_16_PROFIBUS.xorout as u64,
367 check: CRC_16_PROFIBUS.check as u64,
368 keys: crate::CrcKeysStorage::from_keys_fold_256(KEYS_1DCF_FORWARD),
369 };
370
371 // width=16 poly=0x1021 init=0xb2aa refin=true refout=true xorout=0x0000 check=0x63d0 residue=0x0000 name="CRC-16/RIELLO"
372 pub const CRC16_RIELLO: CrcParams = CrcParams {
373 name: NAME_CRC16_RIELLO,
374 algorithm: CrcAlgorithm::Crc16Riello,
375 width: 16,
376 poly: CRC_16_RIELLO.poly as u64,
377 init: CRC_16_RIELLO.init as u64,
378 // 0xB2AA bit-reversed = 0x554D; pre-computed to avoid runtime reversal
379 init_algorithm: 0x554D,
380 refin: CRC_16_RIELLO.refin,
381 refout: CRC_16_RIELLO.refout,
382 xorout: CRC_16_RIELLO.xorout as u64,
383 check: CRC_16_RIELLO.check as u64,
384 keys: crate::CrcKeysStorage::from_keys_fold_256(KEYS_1021_REVERSE),
385 };
386
387 // width=16 poly=0x1021 init=0x1d0f refin=false refout=false xorout=0x0000 check=0xe5cc residue=0x0000 name="CRC-16/SPI-FUJITSU"
388 pub const CRC16_SPI_FUJITSU: CrcParams = CrcParams {
389 name: NAME_CRC16_SPI_FUJITSU,
390 algorithm: CrcAlgorithm::Crc16SpiFujitsu,
391 width: 16,
392 poly: CRC_16_SPI_FUJITSU.poly as u64,
393 init: CRC_16_SPI_FUJITSU.init as u64,
394 init_algorithm: CRC_16_SPI_FUJITSU.init as u64,
395 refin: CRC_16_SPI_FUJITSU.refin,
396 refout: CRC_16_SPI_FUJITSU.refout,
397 xorout: CRC_16_SPI_FUJITSU.xorout as u64,
398 check: CRC_16_SPI_FUJITSU.check as u64,
399 keys: crate::CrcKeysStorage::from_keys_fold_256(KEYS_1021_FORWARD),
400 };
401
402 // width=16 poly=0x8bb7 init=0x0000 refin=false refout=false xorout=0x0000 check=0xd0db residue=0x0000 name="CRC-16/T10-DIF"
403 pub const CRC16_T10_DIF: CrcParams = CrcParams {
404 name: NAME_CRC16_T10_DIF,
405 algorithm: CrcAlgorithm::Crc16T10Dif,
406 width: 16,
407 poly: CRC_16_T10_DIF.poly as u64,
408 init: CRC_16_T10_DIF.init as u64,
409 init_algorithm: CRC_16_T10_DIF.init as u64,
410 refin: CRC_16_T10_DIF.refin,
411 refout: CRC_16_T10_DIF.refout,
412 xorout: CRC_16_T10_DIF.xorout as u64,
413 check: CRC_16_T10_DIF.check as u64,
414 keys: crate::CrcKeysStorage::from_keys_fold_256(KEYS_8BB7_FORWARD),
415 };
416
417 // width=16 poly=0xa097 init=0x0000 refin=false refout=false xorout=0x0000 check=0x0fb3 residue=0x0000 name="CRC-16/TELEDISK"
418 pub const CRC16_TELEDISK: CrcParams = CrcParams {
419 name: NAME_CRC16_TELEDISK,
420 algorithm: CrcAlgorithm::Crc16Teledisk,
421 width: 16,
422 poly: CRC_16_TELEDISK.poly as u64,
423 init: CRC_16_TELEDISK.init as u64,
424 init_algorithm: CRC_16_TELEDISK.init as u64,
425 refin: CRC_16_TELEDISK.refin,
426 refout: CRC_16_TELEDISK.refout,
427 xorout: CRC_16_TELEDISK.xorout as u64,
428 check: CRC_16_TELEDISK.check as u64,
429 keys: crate::CrcKeysStorage::from_keys_fold_256(KEYS_A097_FORWARD),
430 };
431
432 // width=16 poly=0x1021 init=0x89ec refin=true refout=true xorout=0x0000 check=0x26b1 residue=0x0000 name="CRC-16/TMS37157"
433 pub const CRC16_TMS37157: CrcParams = CrcParams {
434 name: NAME_CRC16_TMS37157,
435 algorithm: CrcAlgorithm::Crc16Tms37157,
436 width: 16,
437 poly: CRC_16_TMS37157.poly as u64,
438 init: CRC_16_TMS37157.init as u64,
439 // 0x89EC bit-reversed = 0x3791; pre-computed to avoid runtime reversal
440 init_algorithm: 0x3791,
441 refin: CRC_16_TMS37157.refin,
442 refout: CRC_16_TMS37157.refout,
443 xorout: CRC_16_TMS37157.xorout as u64,
444 check: CRC_16_TMS37157.check as u64,
445 keys: crate::CrcKeysStorage::from_keys_fold_256(KEYS_1021_REVERSE),
446 };
447
448 // width=16 poly=0x8005 init=0x0000 refin=false refout=false xorout=0x0000 check=0xfee8 residue=0x0000 name="CRC-16/UMTS"
449 pub const CRC16_UMTS: CrcParams = CrcParams {
450 name: NAME_CRC16_UMTS,
451 algorithm: CrcAlgorithm::Crc16Umts,
452 width: 16,
453 poly: CRC_16_UMTS.poly as u64,
454 init: CRC_16_UMTS.init as u64,
455 init_algorithm: CRC_16_UMTS.init as u64,
456 refin: CRC_16_UMTS.refin,
457 refout: CRC_16_UMTS.refout,
458 xorout: CRC_16_UMTS.xorout as u64,
459 check: CRC_16_UMTS.check as u64,
460 keys: crate::CrcKeysStorage::from_keys_fold_256(KEYS_8005_FORWARD),
461 };
462
463 // width=16 poly=0x8005 init=0xffff refin=true refout=true xorout=0xffff check=0xb4c8 residue=0xb001 name="CRC-16/USB"
464 pub const CRC16_USB: CrcParams = CrcParams {
465 name: NAME_CRC16_USB,
466 algorithm: CrcAlgorithm::Crc16Usb,
467 width: 16,
468 poly: CRC_16_USB.poly as u64,
469 init: CRC_16_USB.init as u64,
470 init_algorithm: CRC_16_USB.init as u64, // 0xFFFF is symmetric under bit-reversal
471 refin: CRC_16_USB.refin,
472 refout: CRC_16_USB.refout,
473 xorout: CRC_16_USB.xorout as u64,
474 check: CRC_16_USB.check as u64,
475 keys: crate::CrcKeysStorage::from_keys_fold_256(KEYS_8005_REFLECTED),
476 };
477
478 // width=16 poly=0x1021 init=0x0000 refin=false refout=false xorout=0x0000 check=0x31c3 residue=0x0000 name="CRC-16/XMODEM"
479 pub const CRC16_XMODEM: CrcParams = CrcParams {
480 name: NAME_CRC16_XMODEM,
481 algorithm: CrcAlgorithm::Crc16Xmodem,
482 width: 16,
483 poly: CRC_16_XMODEM.poly as u64,
484 init: CRC_16_XMODEM.init as u64,
485 init_algorithm: CRC_16_XMODEM.init as u64,
486 refin: CRC_16_XMODEM.refin,
487 refout: CRC_16_XMODEM.refout,
488 xorout: CRC_16_XMODEM.xorout as u64,
489 check: CRC_16_XMODEM.check as u64,
490 keys: crate::CrcKeysStorage::from_keys_fold_256(KEYS_1021_FORWARD),
491 };
492
493 pub const KEYS_8005_FORWARD: [u64; 23] = [
494 0x0000000000000000,
495 0x8663000000000000,
496 0x8617000000000000,
497 0x8665000000000000,
498 0x8077000000000000,
499 0x8663000000000000,
500 0x807b000000000000,
501 0x00000001fffbffe7,
502 0x0000000180050000,
503 0x6a7a000000000000,
504 0x5ccb000000000000,
505 0x006b000000000000,
506 0xedb3000000000000,
507 0xf997000000000000,
508 0x8c47000000000000,
509 0xbffa000000000000,
510 0x861b000000000000,
511 0xeac3000000000000,
512 0xed6b000000000000,
513 0xf557000000000000,
514 0x806f000000000000,
515 0xf337000000000000,
516 0x867b000000000000,
517 ];
518
519 pub const KEYS_8005_REFLECTED: [u64; 23] = [
520 0x0000000000000000,
521 0x0000000000018cc2,
522 0x000000000001d0c2,
523 0x0000000000014cc2,
524 0x000000000001dc02,
525 0x0000000000018cc2,
526 0x000000000001bc02,
527 0x00000001cfffbfff,
528 0x0000000000014003,
529 0x000000000000bcac,
530 0x000000000001a674,
531 0x000000000001ac00,
532 0x0000000000019b6e,
533 0x000000000001d33e,
534 0x000000000001c462,
535 0x000000000000bffa,
536 0x000000000001b0c2,
537 0x00000000000186ae,
538 0x000000000001ad6e,
539 0x000000000001d55e,
540 0x000000000001ec02,
541 0x000000000001d99e,
542 0x000000000001bcc2,
543 ];
544
545 pub const KEYS_C867_FORWARD: [u64; 23] = [
546 0x0000000000000000,
547 0x1473000000000000,
548 0x7386000000000000,
549 0x8388000000000000,
550 0x1494000000000000,
551 0x1473000000000000,
552 0xb4eb000000000000,
553 0x00000001bcf9ccb5,
554 0x00000001c8670000,
555 0x7b7c000000000000,
556 0xe363000000000000,
557 0x594f000000000000,
558 0xd7bc000000000000,
559 0x47ca000000000000,
560 0x971e000000000000,
561 0x6acb000000000000,
562 0xbd49000000000000,
563 0x9f17000000000000,
564 0x1db5000000000000,
565 0xd834000000000000,
566 0x70c7000000000000,
567 0xb010000000000000,
568 0x7d8b000000000000,
569 ];
570
571 pub const KEYS_0589_FORWARD: [u64; 23] = [
572 0x0000000000000000,
573 0xc2ee000000000000,
574 0xf795000000000000,
575 0x58e7000000000000,
576 0x9aad000000000000,
577 0xc2ee000000000000,
578 0xa847000000000000,
579 0x0000000105981d3f,
580 0x0000000105890000,
581 0x5230000000000000,
582 0x3315000000000000,
583 0xd59f000000000000,
584 0x67c9000000000000,
585 0x148c000000000000,
586 0x4da7000000000000,
587 0xf6c1000000000000,
588 0x5890000000000000,
589 0x0523000000000000,
590 0xd0cf000000000000,
591 0x7cd2000000000000,
592 0x1624000000000000,
593 0xf411000000000000,
594 0x1d58000000000000,
595 ];
596
597 pub const KEYS_3D65_REFLECTED: [u64; 23] = [
598 0x0000000000000000,
599 0x0000000000001612,
600 0x0000000000004d8c,
601 0x0000000000017d88,
602 0x000000000001b860,
603 0x0000000000001612,
604 0x000000000000c2e8,
605 0x00000000f81e8e39,
606 0x0000000000014d79,
607 0x000000000001b406,
608 0x0000000000000400,
609 0x000000000000c654,
610 0x0000000000006f94,
611 0x00000000000140ba,
612 0x000000000000aa92,
613 0x0000000000000020,
614 0x00000000000058b2,
615 0x000000000001c116,
616 0x0000000000009664,
617 0x0000000000015cfa,
618 0x000000000001c458,
619 0x000000000000cdc0,
620 0x000000000000b470,
621 ];
622
623 pub const KEYS_3D65_FORWARD: [u64; 23] = [
624 0x0000000000000000,
625 0x90d0000000000000,
626 0x6364000000000000,
627 0x237d000000000000,
628 0x0c3b000000000000,
629 0x90d0000000000000,
630 0x2e86000000000000,
631 0x0000000138e2f03e,
632 0x000000013d650000,
633 0xc05b000000000000,
634 0x0040000000000000,
635 0x54c6000000000000,
636 0x53ec000000000000,
637 0xba05000000000000,
638 0x92aa000000000000,
639 0x0800000000000000,
640 0x9a34000000000000,
641 0xd107000000000000,
642 0x4cd2000000000000,
643 0xbe75000000000000,
644 0x3447000000000000,
645 0x0766000000000000,
646 0x1c5a000000000000,
647 ];
648
649 pub const KEYS_1021_FORWARD: [u64; 23] = [
650 0x0000000000000000,
651 0xeb23000000000000,
652 0x10e2000000000000,
653 0xfa0d000000000000,
654 0x36fb000000000000,
655 0xeb23000000000000,
656 0xaa51000000000000,
657 0x0000000111303471,
658 0x0000000110210000,
659 0xf4e7000000000000,
660 0x4347000000000000,
661 0x15b7000000000000,
662 0x9e3a000000000000,
663 0x8420000000000000,
664 0x9c1a000000000000,
665 0x9fe5000000000000,
666 0x78b3000000000000,
667 0xb8e0000000000000,
668 0xbd64000000000000,
669 0x45b4000000000000,
670 0x8ddc000000000000,
671 0x2093000000000000,
672 0x3f68000000000000,
673 ];
674
675 pub const KEYS_6F63_FORWARD: [u64; 23] = [
676 0x0000000000000000,
677 0xe601000000000000,
678 0xf83f000000000000,
679 0x29c0000000000000,
680 0xfa19000000000000,
681 0xe601000000000000,
682 0x4dd4000000000000,
683 0x000000017d0b9ecc,
684 0x000000016f630000,
685 0x5342000000000000,
686 0xa2b2000000000000,
687 0x14e0000000000000,
688 0xcabd000000000000,
689 0x29a1000000000000,
690 0x5159000000000000,
691 0x0a70000000000000,
692 0xd2ef000000000000,
693 0xa361000000000000,
694 0x9f1d000000000000,
695 0x0538000000000000,
696 0xdec6000000000000,
697 0x42c6000000000000,
698 0x0867000000000000,
699 ];
700
701 pub const KEYS_5935_FORWARD: [u64; 23] = [
702 0x0000000000000000,
703 0x0d0e000000000000,
704 0x5163000000000000,
705 0x1286000000000000,
706 0x1000000000000000,
707 0x0d0e000000000000,
708 0x5866000000000000,
709 0x000000014ce5c8be,
710 0x0000000159350000,
711 0xfb76000000000000,
712 0xdbdd000000000000,
713 0x250c000000000000,
714 0x2000000000000000,
715 0xafd9000000000000,
716 0xee8f000000000000,
717 0x4a18000000000000,
718 0x4000000000000000,
719 0x0687000000000000,
720 0x842b000000000000,
721 0x9430000000000000,
722 0x8000000000000000,
723 0xd0d9000000000000,
724 0x0100000000000000,
725 ];
726
727 pub const KEYS_080B_REFLECTED: [u64; 23] = [
728 0x0000000000000000,
729 0x000000000001986c,
730 0x0000000000006b98,
731 0x00000000000016a8,
732 0x0000000000011ef6,
733 0x000000000001986c,
734 0x00000000000170fa,
735 0x0000000180912421,
736 0x000000000001a021,
737 0x000000000001f852,
738 0x000000000001b176,
739 0x000000000000183c,
740 0x0000000000016ffc,
741 0x00000000000015f4,
742 0x0000000000003308,
743 0x00000000000018a4,
744 0x000000000000cd12,
745 0x0000000000010052,
746 0x000000000001faaa,
747 0x0000000000013e86,
748 0x0000000000009bc4,
749 0x0000000000005f3a,
750 0x000000000001c124,
751 ];
752
753 pub const KEYS_755B_FORWARD: [u64; 23] = [
754 0x0000000000000000,
755 0x0e5f000000000000,
756 0x21d3000000000000,
757 0x16bf000000000000,
758 0x8e20000000000000,
759 0x0e5f000000000000,
760 0x3c73000000000000,
761 0x0000000167c863d9,
762 0x00000001755b0000,
763 0xa8cb000000000000,
764 0x7562000000000000,
765 0x0f7d000000000000,
766 0x8c80000000000000,
767 0x6285000000000000,
768 0x8c37000000000000,
769 0x06a7000000000000,
770 0x937d000000000000,
771 0x9aac000000000000,
772 0xb5b7000000000000,
773 0xff2f000000000000,
774 0xf1df000000000000,
775 0x407d000000000000,
776 0x597e000000000000,
777 ];
778
779 pub const KEYS_1DCF_FORWARD: [u64; 23] = [
780 0x0000000000000000,
781 0x4ee2000000000000,
782 0x8462000000000000,
783 0xfe12000000000000,
784 0x2690000000000000,
785 0x4ee2000000000000,
786 0x19ae000000000000,
787 0x000000011c842752,
788 0x000000011dcf0000,
789 0xe047000000000000,
790 0x0ad2000000000000,
791 0x4c6c000000000000,
792 0xe7e9000000000000,
793 0x1940000000000000,
794 0x22a2000000000000,
795 0xaddd000000000000,
796 0x5fd5000000000000,
797 0x28c9000000000000,
798 0x6186000000000000,
799 0xeb76000000000000,
800 0x1db2000000000000,
801 0xa36b000000000000,
802 0x3557000000000000,
803 ];
804
805 pub const KEYS_A097_FORWARD: [u64; 23] = [
806 0x0000000000000000,
807 0x4c3f000000000000,
808 0xc8aa000000000000,
809 0x6e48000000000000,
810 0x6c83000000000000,
811 0x4c3f000000000000,
812 0xf15f000000000000,
813 0x00000001d31c0419,
814 0x00000001a0970000,
815 0x8cfa000000000000,
816 0x3a08000000000000,
817 0xff4f000000000000,
818 0x872c000000000000,
819 0xe3ac000000000000,
820 0x38d7000000000000,
821 0xd7ae000000000000,
822 0x5be1000000000000,
823 0xb5e1000000000000,
824 0x2a65000000000000,
825 0x2922000000000000,
826 0x7d9d000000000000,
827 0xf735000000000000,
828 0xb9e2000000000000,
829 ];
830
831 pub const KEYS_8BB7_FORWARD: [u64; 23] = [
832 0x0000000000000000,
833 0x2d56000000000000, // 2^(32* 3) mod Q << 32
834 0x06df000000000000, // 2^(32* 5) mod Q << 32
835 0x9d9d000000000000, // 2^(32*31) mod Q << 32
836 0x7cf5000000000000, // 2^(32*33) mod Q << 32
837 0x2d56000000000000, // 2^(32* 3) mod Q << 32
838 0x1368000000000000, // 2^(32* 2) mod Q << 32
839 0x00000001f65a57f8, // floor(2^64/Q)
840 0x000000018bb70000, // Q
841 0xceae000000000000, // 2^(32*27) mod Q << 32
842 0xbfd6000000000000, // 2^(32*29) mod Q << 32
843 0x1e16000000000000, // 2^(32*23) mod Q << 32
844 0x713c000000000000, // 2^(32*25) mod Q << 32
845 0xf7f9000000000000, // 2^(32*19) mod Q << 32
846 0x80a6000000000000, // 2^(32*21) mod Q << 32
847 0x044c000000000000, // 2^(32*15) mod Q << 32
848 0xe658000000000000, // 2^(32*17) mod Q << 32
849 0xad18000000000000, // 2^(32*11) mod Q << 32
850 0xa497000000000000, // 2^(32*13) mod Q << 32
851 0x6ee3000000000000, // 2^(32* 7) mod Q << 32
852 0xe7b5000000000000, // 2^(32* 9) mod Q << 32
853 0xdccf000000000000, // 2^(32*63) mod Q << 32 (256-byte folding)
854 0x4b0b000000000000, // 2^(32*65) mod Q << 32 (256-byte folding)
855 ];
856
857 pub const KEYS_1021_REVERSE: [u64; 23] = [
858 0x0000000000000000,
859 0x00000000000189ae, // (2^(32* 3) mod P(x))' << 1
860 0x0000000000008e10, // (2^(32* 5) mod P(x))' << 1
861 0x00000000000160be, // (2^(32*31) mod P(x))' << 1
862 0x000000000001bed8, // (2^(32*33) mod P(x))' << 1
863 0x00000000000189ae, // (2^(32* 3) mod P(x))' << 1
864 0x00000000000114aa, // (2^(32* 2) mod P(x))' << 1
865 0x000000011c581911, // (floor(2^64/P(x)))'
866 0x0000000000010811, // (P(x))'
867 0x000000000001ce5e, // (2^(32*27) mod P(x))' << 1
868 0x000000000001c584, // (2^(32*29) mod P(x))' << 1
869 0x000000000001db50, // (2^(32*23) mod P(x))' << 1
870 0x000000000000b8f2, // (2^(32*25) mod P(x))' << 1
871 0x0000000000000842, // (2^(32*19) mod P(x))' << 1
872 0x000000000000b072, // (2^(32*21) mod P(x))' << 1
873 0x0000000000014ff2, // (2^(32*15) mod P(x))' << 1
874 0x0000000000019a3c, // (2^(32*17) mod P(x))' << 1
875 0x0000000000000e3a, // (2^(32*11) mod P(x))' << 1
876 0x0000000000004d7a, // (2^(32*13) mod P(x))' << 1
877 0x0000000000005b44, // (2^(32* 7) mod P(x))' << 1
878 0x0000000000007762, // (2^(32* 9) mod P(x))' << 1
879 0x0000000000019208, // (2^(32*63) mod P(x))' << 1 (256-byte folding)
880 0x0000000000002df8, // (2^(32*65) mod P(x))' << 1 (256-byte folding)
881 ];