/rust/registry/src/index.crates.io-6f17d22bba15001f/crc-any-2.5.0/src/lib.rs
Line | Count | Source (jump to first uncovered line) |
1 | | /*! |
2 | | # CRC Any |
3 | | |
4 | | To compute CRC values by providing the length of bits, expression, reflection, an initial value and a final xor value. It has many built-in CRC functions. |
5 | | |
6 | | ## Usage |
7 | | |
8 | | You can use `create_crc` associated function to create a CRC instance by providing the length of bits, expression, reflection, an initial value and a final xor value. For example, if you want to compute a CRC-24 value. |
9 | | |
10 | | ```rust |
11 | | use crc_any::CRC; |
12 | | |
13 | | let mut crc24 = CRC::create_crc(0x0000000000864CFB, 24, 0x0000000000B704CE, 0x0000000000000000, false); |
14 | | |
15 | | crc24.digest(b"hello"); |
16 | | */ |
17 | | #![cfg_attr( |
18 | | feature = "alloc", |
19 | | doc = " |
20 | | |
21 | | assert_eq!([71, 245, 138].to_vec(), crc24.get_crc_vec_be()); |
22 | | assert_eq!(\"0x47F58A\", &crc24.to_string()); |
23 | | " |
24 | | )] |
25 | | /*! |
26 | | ``` |
27 | | */ |
28 | | /*! |
29 | | To simplify the usage, there are several common versions of CRC whose computing functions are already built-in. |
30 | | |
31 | | * crc3gsm |
32 | | * crc4itu |
33 | | * crc4interlaken |
34 | | * crc5epc |
35 | | * crc5itu |
36 | | * crc5usb |
37 | | * crc6cdma2000_a |
38 | | * crc6cdma2000_b |
39 | | * crc6darc |
40 | | * crc6gsm |
41 | | * crc6itu |
42 | | * crc7 |
43 | | * crc7umts |
44 | | * crc8 |
45 | | * crc8cdma2000 |
46 | | * crc8darc |
47 | | * crc8dvb_s2 |
48 | | * crc8ebu |
49 | | * crc8icode |
50 | | * crc8itu |
51 | | * crc8maxim |
52 | | * crc8rohc |
53 | | * crc8wcdma |
54 | | * crc10 |
55 | | * crc10cdma2000 |
56 | | * crc10gsm |
57 | | * crc11 |
58 | | * crc12 |
59 | | * crc12cdma2000 |
60 | | * crc12gsm |
61 | | * crc13bbc |
62 | | * crc14darc |
63 | | * crc14gsm |
64 | | * crc15can |
65 | | * crc15mpt1327 |
66 | | * crc16 |
67 | | * crc16ccitt_false |
68 | | * crc16aug_ccitt |
69 | | * crc16buypass |
70 | | * crc16cdma2000 |
71 | | * crc16dds_110 |
72 | | * crc16dect_r |
73 | | * crc16dect_x |
74 | | * crc16dnp |
75 | | * crc16en_13757 |
76 | | * crc16genibus |
77 | | * crc16maxim |
78 | | * crc16mcrf4cc |
79 | | * crc16riello |
80 | | * crc16t10_dif |
81 | | * crc16teledisk |
82 | | * crc16tms13157 |
83 | | * crc16usb |
84 | | * crc_a |
85 | | * crc16kermit |
86 | | * crc16modbus |
87 | | * crc16_x25 |
88 | | * crc16xmodem |
89 | | * crc17can |
90 | | * crc21can |
91 | | * crc24 |
92 | | * crc24ble |
93 | | * crc24flexray_a |
94 | | * crc24flexray_b |
95 | | * crc24lte_a |
96 | | * crc24lte_b |
97 | | * crc24os9 |
98 | | * crc30cdma |
99 | | * crc32 |
100 | | * It also called `crc32b` in `mhash`. |
101 | | * crc32mhash |
102 | | * `mhash` is a common library which has two weird versions of CRC32 called `crc32` and `crc32b`. `crc32` and `crc32mhash` in this module are `crc32b` and `crc32` in mhash respectively. |
103 | | * crc32bzip2 |
104 | | * crc32c |
105 | | * crc32d |
106 | | * crc32mpeg2 |
107 | | * crc32posix |
108 | | * crc32q |
109 | | * crc32jamcrc |
110 | | * crc32xfer |
111 | | * crc40gsm |
112 | | * crc64 |
113 | | * crc64iso |
114 | | * crc64we |
115 | | * crc64jones |
116 | | |
117 | | For instance, |
118 | | |
119 | | ```rust |
120 | | use crc_any::CRC; |
121 | | |
122 | | let mut crc64 = CRC::crc64(); |
123 | | |
124 | | crc64.digest(b"hello"); |
125 | | */ |
126 | | #![cfg_attr( |
127 | | feature = "alloc", |
128 | | doc = " |
129 | | |
130 | | assert_eq!([64, 84, 74, 48, 97, 55, 182, 236].to_vec(), crc64.get_crc_vec_be()); |
131 | | assert_eq!(\"0x40544A306137B6EC\", &crc64.to_string()); |
132 | | " |
133 | | )] |
134 | | /*! |
135 | | ``` |
136 | | */ |
137 | | /*! |
138 | | After getting a CRC value, you can still use the `digest` method to continue computing the next CRC values. |
139 | | |
140 | | ## Heapless Support |
141 | | |
142 | | To make sure this crate will not use heap memory allocation, you can disable the default features. |
143 | | |
144 | | ```toml |
145 | | [dependencies.crc-any] |
146 | | version = "*" |
147 | | default-features = false |
148 | | ``` |
149 | | |
150 | | After doing that, the `get_crc_vec_be` and `get_crc_vec_le` methods can not be used. But if you still need this crate to return a `Vec` without dynamic allocation, you can enable the `heapless` feature to make the `get_crc_heapless_vec_be` and `get_crc_heapless_vec_le` methods available. |
151 | | |
152 | | ```toml |
153 | | [dependencies.crc-any] |
154 | | version = "*" |
155 | | default-features = false |
156 | | features = ["heapless"] |
157 | | ``` |
158 | | */ |
159 | | |
160 | | #![cfg_attr(not(feature = "std"), no_std)] |
161 | | |
162 | | #[cfg(feature = "alloc")] |
163 | | #[macro_use] |
164 | | extern crate alloc; |
165 | | |
166 | | #[cfg(feature = "alloc")] |
167 | | use alloc::fmt::{self, Display, Formatter}; |
168 | | #[cfg(feature = "alloc")] |
169 | | use alloc::vec::Vec; |
170 | | |
171 | | #[cfg(feature = "heapless")] |
172 | | use heapless::Vec as HeaplessVec; |
173 | | |
174 | | mod constants; |
175 | | mod crc_u16; |
176 | | mod crc_u32; |
177 | | mod crc_u64; |
178 | | mod crc_u8; |
179 | | mod lookup_table; |
180 | | |
181 | | pub use crc_u16::CRCu16; |
182 | | pub use crc_u32::CRCu32; |
183 | | pub use crc_u64::CRCu64; |
184 | | pub use crc_u8::CRCu8; |
185 | | |
186 | | #[allow(clippy::upper_case_acronyms, clippy::large_enum_variant)] |
187 | | /// This struct can help you compute a CRC value. |
188 | | #[cfg_attr(feature = "alloc", derive(Debug))] |
189 | | pub enum CRC { |
190 | | CRCu8(CRCu8), |
191 | | CRCu16(CRCu16), |
192 | | CRCu32(CRCu32), |
193 | | CRCu64(CRCu64), |
194 | | } |
195 | | |
196 | | #[cfg(feature = "alloc")] |
197 | | impl Display for CRC { |
198 | | #[inline] |
199 | 0 | fn fmt(&self, f: &mut Formatter) -> Result<(), fmt::Error> { |
200 | 0 | match self { |
201 | 0 | CRC::CRCu8(crc) => Display::fmt(crc, f), |
202 | 0 | CRC::CRCu16(crc) => Display::fmt(crc, f), |
203 | 0 | CRC::CRCu32(crc) => Display::fmt(crc, f), |
204 | 0 | CRC::CRCu64(crc) => Display::fmt(crc, f), |
205 | | } |
206 | 0 | } |
207 | | } |
208 | | |
209 | | impl CRC { |
210 | | /// Create a CRC instance by providing the length of bits, expression, reflection, an initial value and a final xor value. |
211 | | #[inline] |
212 | 0 | pub fn create_crc(poly: u64, bits: u8, initial: u64, final_xor: u64, reflect: bool) -> CRC { |
213 | 0 | if bits <= 8 { |
214 | 0 | Self::create_crc_u8(poly as u8, bits, initial as u8, final_xor as u8, reflect) |
215 | 0 | } else if bits <= 16 { |
216 | 0 | Self::create_crc_u16(poly as u16, bits, initial as u16, final_xor as u16, reflect) |
217 | 0 | } else if bits <= 32 { |
218 | 0 | Self::create_crc_u32(poly as u32, bits, initial as u32, final_xor as u32, reflect) |
219 | 0 | } else if bits <= 64 { |
220 | 0 | Self::create_crc_u64(poly, bits, initial, final_xor, reflect) |
221 | | } else { |
222 | 0 | unimplemented!() |
223 | | } |
224 | 0 | } |
225 | | |
226 | | /// Create a CRC instance by providing the length of bits, expression, reflection, an initial value and a final xor value. |
227 | | #[inline] |
228 | 0 | pub fn create_crc_u8(poly: u8, bits: u8, initial: u8, final_xor: u8, reflect: bool) -> CRC { |
229 | 0 | let crc = CRCu8::create_crc(poly, bits, initial, final_xor, reflect); |
230 | 0 |
|
231 | 0 | CRC::CRCu8(crc) |
232 | 0 | } |
233 | | |
234 | | /// Create a CRC instance by providing the length of bits, expression, reflection, an initial value and a final xor value. |
235 | | #[inline] |
236 | 0 | pub fn create_crc_u16(poly: u16, bits: u8, initial: u16, final_xor: u16, reflect: bool) -> CRC { |
237 | 0 | let crc = CRCu16::create_crc(poly, bits, initial, final_xor, reflect); |
238 | 0 |
|
239 | 0 | CRC::CRCu16(crc) |
240 | 0 | } |
241 | | |
242 | | /// Create a CRC instance by providing the length of bits, expression, reflection, an initial value and a final xor value. |
243 | | #[inline] |
244 | 0 | pub fn create_crc_u32(poly: u32, bits: u8, initial: u32, final_xor: u32, reflect: bool) -> CRC { |
245 | 0 | let crc = CRCu32::create_crc(poly, bits, initial, final_xor, reflect); |
246 | 0 |
|
247 | 0 | CRC::CRCu32(crc) |
248 | 0 | } |
249 | | |
250 | | /// Create a CRC instance by providing the length of bits, expression, reflection, an initial value and a final xor value. |
251 | | #[inline] |
252 | 0 | pub fn create_crc_u64(poly: u64, bits: u8, initial: u64, final_xor: u64, reflect: bool) -> CRC { |
253 | 0 | let crc = CRCu64::create_crc(poly, bits, initial, final_xor, reflect); |
254 | 0 |
|
255 | 0 | CRC::CRCu64(crc) |
256 | 0 | } |
257 | | |
258 | | /// Digest some data. |
259 | | #[inline] |
260 | 336 | pub fn digest<T: ?Sized + AsRef<[u8]>>(&mut self, data: &T) { |
261 | 336 | match self { |
262 | 0 | CRC::CRCu8(crc) => crc.digest(data), |
263 | 0 | CRC::CRCu16(crc) => crc.digest(data), |
264 | 336 | CRC::CRCu32(crc) => crc.digest(data), |
265 | 0 | CRC::CRCu64(crc) => crc.digest(data), |
266 | | } |
267 | 336 | } <crc_any::CRC>::digest::<&mut [u8]> Line | Count | Source | 260 | 336 | pub fn digest<T: ?Sized + AsRef<[u8]>>(&mut self, data: &T) { | 261 | 336 | match self { | 262 | 0 | CRC::CRCu8(crc) => crc.digest(data), | 263 | 0 | CRC::CRCu16(crc) => crc.digest(data), | 264 | 336 | CRC::CRCu32(crc) => crc.digest(data), | 265 | 0 | CRC::CRCu64(crc) => crc.digest(data), | 266 | | } | 267 | 336 | } |
Unexecuted instantiation: <crc_any::CRC>::digest::<_> |
268 | | |
269 | | /// Reset the sum. |
270 | | #[inline] |
271 | 0 | pub fn reset(&mut self) { |
272 | 0 | match self { |
273 | 0 | CRC::CRCu8(crc) => crc.reset(), |
274 | 0 | CRC::CRCu16(crc) => crc.reset(), |
275 | 0 | CRC::CRCu32(crc) => crc.reset(), |
276 | 0 | CRC::CRCu64(crc) => crc.reset(), |
277 | | } |
278 | 0 | } |
279 | | |
280 | | /// Get the current CRC value (it always returns a `u64` value). You can continue calling `digest` method even after getting a CRC value. |
281 | | #[inline] |
282 | 336 | pub fn get_crc(&mut self) -> u64 { |
283 | 336 | match self { |
284 | 0 | CRC::CRCu8(crc) => u64::from(crc.get_crc()), |
285 | 0 | CRC::CRCu16(crc) => u64::from(crc.get_crc()), |
286 | 336 | CRC::CRCu32(crc) => u64::from(crc.get_crc()), |
287 | 0 | CRC::CRCu64(crc) => crc.get_crc(), |
288 | | } |
289 | 336 | } Line | Count | Source | 282 | 336 | pub fn get_crc(&mut self) -> u64 { | 283 | 336 | match self { | 284 | 0 | CRC::CRCu8(crc) => u64::from(crc.get_crc()), | 285 | 0 | CRC::CRCu16(crc) => u64::from(crc.get_crc()), | 286 | 336 | CRC::CRCu32(crc) => u64::from(crc.get_crc()), | 287 | 0 | CRC::CRCu64(crc) => crc.get_crc(), | 288 | | } | 289 | 336 | } |
Unexecuted instantiation: <crc_any::CRC>::get_crc |
290 | | } |
291 | | |
292 | | #[cfg(feature = "alloc")] |
293 | | impl CRC { |
294 | | /// Get the current CRC value (it always returns a vec instance with a length corresponding to the CRC bits). You can continue calling `digest` method even after getting a CRC value. |
295 | | #[inline] |
296 | 0 | pub fn get_crc_vec_le(&mut self) -> Vec<u8> { |
297 | 0 | match self { |
298 | 0 | CRC::CRCu8(crc) => vec![crc.get_crc()], |
299 | 0 | CRC::CRCu16(crc) => crc.get_crc_vec_le(), |
300 | 0 | CRC::CRCu32(crc) => crc.get_crc_vec_le(), |
301 | 0 | CRC::CRCu64(crc) => crc.get_crc_vec_le(), |
302 | | } |
303 | 0 | } |
304 | | |
305 | | /// Get the current CRC value (it always returns a vec instance with a length corresponding to the CRC bits). You can continue calling `digest` method even after getting a CRC value. |
306 | | #[inline] |
307 | 0 | pub fn get_crc_vec_be(&mut self) -> Vec<u8> { |
308 | 0 | match self { |
309 | 0 | CRC::CRCu8(crc) => vec![crc.get_crc()], |
310 | 0 | CRC::CRCu16(crc) => crc.get_crc_vec_be(), |
311 | 0 | CRC::CRCu32(crc) => crc.get_crc_vec_be(), |
312 | 0 | CRC::CRCu64(crc) => crc.get_crc_vec_be(), |
313 | | } |
314 | 0 | } |
315 | | } |
316 | | |
317 | | #[cfg(feature = "heapless")] |
318 | | impl CRC { |
319 | | /// Get the current CRC value (it always returns a vec instance with a length corresponding to the CRC bits). You can continue calling `digest` method even after getting a CRC value. |
320 | | pub fn get_crc_heapless_vec_le(&mut self) -> HeaplessVec<u8, 8> { |
321 | | let mut vec = HeaplessVec::new(); |
322 | | |
323 | | let bits = match self { |
324 | | CRC::CRCu8(crc) => f64::from(crc.bits), |
325 | | CRC::CRCu16(crc) => f64::from(crc.bits), |
326 | | CRC::CRCu32(crc) => f64::from(crc.bits), |
327 | | CRC::CRCu64(crc) => f64::from(crc.bits), |
328 | | }; |
329 | | |
330 | | let e = ((bits + 7f64) / 8f64) as u64; |
331 | | |
332 | | let e_dec = e - 1; |
333 | | |
334 | | let o = e_dec * 8; |
335 | | |
336 | | let crc = self.get_crc(); |
337 | | |
338 | | for i in 0..e { |
339 | | vec.push((crc << ((e_dec - i) * 8) >> o) as u8).unwrap(); |
340 | | } |
341 | | |
342 | | vec |
343 | | } |
344 | | |
345 | | /// Get the current CRC value (it always returns a vec instance with a length corresponding to the CRC bits). You can continue calling `digest` method even after getting a CRC value. |
346 | | pub fn get_crc_heapless_vec_be(&mut self) -> HeaplessVec<u8, 8> { |
347 | | let mut vec = HeaplessVec::new(); |
348 | | |
349 | | let bits = match self { |
350 | | CRC::CRCu8(crc) => f64::from(crc.bits), |
351 | | CRC::CRCu16(crc) => f64::from(crc.bits), |
352 | | CRC::CRCu32(crc) => f64::from(crc.bits), |
353 | | CRC::CRCu64(crc) => f64::from(crc.bits), |
354 | | }; |
355 | | |
356 | | let e = ((bits + 7f64) / 8f64) as u64; |
357 | | |
358 | | let e_dec = e - 1; |
359 | | |
360 | | let o = e_dec * 8; |
361 | | |
362 | | let crc = self.get_crc(); |
363 | | |
364 | | for i in 0..e { |
365 | | vec.push((crc << (i * 8) >> o) as u8).unwrap(); |
366 | | } |
367 | | |
368 | | vec |
369 | | } |
370 | | } |
371 | | |
372 | | impl CRC { |
373 | | // TODO: CRC-3 |
374 | | |
375 | | /// |Check|Poly|Init|Ref|XorOut| |
376 | | /// |---|---|---|---|---| |
377 | | /// |0x4|0x3|0x0|false|0x7| |
378 | | /// |
379 | | /// ``` |
380 | | /// # use crc_any::CRC; |
381 | | /// let mut crc = CRC::crc3gsm(); |
382 | | /// crc.digest(b"123456789"); |
383 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x4\", &crc.to_string());")] |
384 | | /// ``` |
385 | 0 | pub fn crc3gsm() -> CRC { |
386 | 0 | CRC::CRCu8(CRCu8::crc3gsm()) |
387 | 0 | } |
388 | | |
389 | | // TODO: CRC-4 |
390 | | |
391 | | /// |Check|Poly|Init|Ref|XorOut| |
392 | | /// |---|---|---|---|---| |
393 | | /// |0x7|0x3 (rev: 0xC)|0x0|true|0x0| |
394 | | /// |
395 | | /// ``` |
396 | | /// # use crc_any::CRC; |
397 | | /// let mut crc = CRC::crc4itu(); |
398 | | /// crc.digest(b"123456789"); |
399 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x7\", &crc.to_string());")] |
400 | | /// ``` |
401 | 0 | pub fn crc4itu() -> CRC { |
402 | 0 | CRC::CRCu8(CRCu8::crc4itu()) |
403 | 0 | } |
404 | | |
405 | | /// |Check|Poly|Init|Ref|XorOut| |
406 | | /// |---|---|---|---|---| |
407 | | /// |0xB|0x3|0xF|false|0xF| |
408 | | /// |
409 | | /// ``` |
410 | | /// # use crc_any::CRC; |
411 | | /// let mut crc = CRC::crc4interlaken(); |
412 | | /// crc.digest(b"123456789"); |
413 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0xB\", &crc.to_string());")] |
414 | | /// ``` |
415 | 0 | pub fn crc4interlaken() -> CRC { |
416 | 0 | CRC::CRCu8(CRCu8::crc4interlaken()) |
417 | 0 | } |
418 | | |
419 | | // TODO: CRC-5 |
420 | | |
421 | | /// |Check|Poly|Init|Ref|XorOut| |
422 | | /// |---|---|---|---|---| |
423 | | /// |0x00|0x09|0x09|false|0x00| |
424 | | /// |
425 | | /// ``` |
426 | | /// # use crc_any::CRC; |
427 | | /// let mut crc = CRC::crc5epc(); |
428 | | /// crc.digest(b"123456789"); |
429 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x00\", &crc.to_string());")] |
430 | | /// ``` |
431 | 0 | pub fn crc5epc() -> CRC { |
432 | 0 | CRC::CRCu8(CRCu8::crc5epc()) |
433 | 0 | } |
434 | | |
435 | | /// |Check|Poly|Init|Ref|XorOut| |
436 | | /// |---|---|---|---|---| |
437 | | /// |0x07|0x15 (rev: 0x15)|0x00|true|0x00| |
438 | | /// |
439 | | /// ``` |
440 | | /// # use crc_any::CRC; |
441 | | /// let mut crc = CRC::crc5itu(); |
442 | | /// crc.digest(b"123456789"); |
443 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x07\", &crc.to_string());")] |
444 | | /// ``` |
445 | 0 | pub fn crc5itu() -> CRC { |
446 | 0 | CRC::CRCu8(CRCu8::crc5itu()) |
447 | 0 | } |
448 | | |
449 | | /// |Check|Poly|Init|Ref|XorOut| |
450 | | /// |---|---|---|---|---| |
451 | | /// |0x19|0x05 (rev: 0x14)|0x1F|true|0x1F| |
452 | | /// |
453 | | /// ``` |
454 | | /// # use crc_any::CRC; |
455 | | /// let mut crc = CRC::crc5usb(); |
456 | | /// crc.digest(b"123456789"); |
457 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x19\", &crc.to_string());")] |
458 | | /// ``` |
459 | 0 | pub fn crc5usb() -> CRC { |
460 | 0 | CRC::CRCu8(CRCu8::crc5usb()) |
461 | 0 | } |
462 | | |
463 | | // TODO: CRC-6 |
464 | | |
465 | | /// |Check|Poly|Init|Ref|XorOut| |
466 | | /// |---|---|---|---|---| |
467 | | /// |0x0D|0x27|0x3F|false|0x00| |
468 | | /// |
469 | | /// ``` |
470 | | /// # use crc_any::CRC; |
471 | | /// let mut crc = CRC::crc6cdma2000_a(); |
472 | | /// crc.digest(b"123456789"); |
473 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x0D\", &crc.to_string());")] |
474 | | /// ``` |
475 | | #[inline] |
476 | 0 | pub fn crc6cdma2000_a() -> CRC { |
477 | 0 | CRC::CRCu8(CRCu8::crc6cdma2000_a()) |
478 | 0 | } |
479 | | |
480 | | /// |Check|Poly|Init|Ref|XorOut| |
481 | | /// |---|---|---|---|---| |
482 | | /// |0x3B|0x07|0x3F|false|0x00| |
483 | | /// |
484 | | /// ``` |
485 | | /// # use crc_any::CRC; |
486 | | /// let mut crc = CRC::crc6cdma2000_b(); |
487 | | /// crc.digest(b"123456789"); |
488 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x3B\", &crc.to_string());")] |
489 | | /// ``` |
490 | | #[inline] |
491 | 0 | pub fn crc6cdma2000_b() -> CRC { |
492 | 0 | CRC::CRCu8(CRCu8::crc6cdma2000_b()) |
493 | 0 | } |
494 | | |
495 | | /// |Check|Poly|Init|Ref|XorOut| |
496 | | /// |---|---|---|---|---| |
497 | | /// |0x26|0x19 (rev: 0x26)|0x00|true|0x00| |
498 | | /// |
499 | | /// ``` |
500 | | /// # use crc_any::CRC; |
501 | | /// let mut crc = CRC::crc6darc(); |
502 | | /// crc.digest(b"123456789"); |
503 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x26\", &crc.to_string());")] |
504 | | /// ``` |
505 | | #[inline] |
506 | 0 | pub fn crc6darc() -> CRC { |
507 | 0 | CRC::CRCu8(CRCu8::crc6darc()) |
508 | 0 | } |
509 | | |
510 | | /// |Check|Poly|Init|Ref|XorOut| |
511 | | /// |---|---|---|---|---| |
512 | | /// |0x13|0x2F|0x00|false|0x3F| |
513 | | /// |
514 | | /// ``` |
515 | | /// # use crc_any::CRC; |
516 | | /// let mut crc = CRC::crc6gsm(); |
517 | | /// crc.digest(b"123456789"); |
518 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x13\", &crc.to_string());")] |
519 | | /// ``` |
520 | | #[inline] |
521 | 0 | pub fn crc6gsm() -> CRC { |
522 | 0 | CRC::CRCu8(CRCu8::crc6gsm()) |
523 | 0 | } |
524 | | |
525 | | /// |Check|Poly|Init|Ref|XorOut| |
526 | | /// |---|---|---|---|---| |
527 | | /// |0x06|0x03 (rev: 0x30)|0x00|true|0x00| |
528 | | /// |
529 | | /// ``` |
530 | | /// # use crc_any::CRC; |
531 | | /// let mut crc = CRC::crc6itu(); |
532 | | /// crc.digest(b"123456789"); |
533 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x06\", &crc.to_string());")] |
534 | | /// ``` |
535 | | #[inline] |
536 | 0 | pub fn crc6itu() -> CRC { |
537 | 0 | CRC::CRCu8(CRCu8::crc6itu()) |
538 | 0 | } |
539 | | |
540 | | // TODO: CRC-7 |
541 | | |
542 | | /// |Check|Poly|Init|Ref|XorOut| |
543 | | /// |---|---|---|---|---| |
544 | | /// |0x75|0x09|0x00|false|0x00| |
545 | | /// |
546 | | /// ``` |
547 | | /// # use crc_any::CRC; |
548 | | /// let mut crc = CRC::crc7(); |
549 | | /// crc.digest(b"123456789"); |
550 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x75\", &crc.to_string());")] |
551 | | /// ``` |
552 | | #[inline] |
553 | 0 | pub fn crc7() -> CRC { |
554 | 0 | CRC::CRCu8(CRCu8::crc7()) |
555 | 0 | } |
556 | | |
557 | | /// |Check|Poly|Init|Ref|XorOut| |
558 | | /// |---|---|---|---|---| |
559 | | /// |0x61|0x45|0x00|false|0x00| |
560 | | /// |
561 | | /// ``` |
562 | | /// # use crc_any::CRC; |
563 | | /// let mut crc = CRC::crc7umts(); |
564 | | /// crc.digest(b"123456789"); |
565 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x61\", &crc.to_string());")] |
566 | | /// ``` |
567 | | #[inline] |
568 | 0 | pub fn crc7umts() -> CRC { |
569 | 0 | CRC::CRCu8(CRCu8::crc7umts()) |
570 | 0 | } |
571 | | |
572 | | // TODO: CRC-8 |
573 | | |
574 | | /// |Check|Poly|Init|Ref|XorOut| |
575 | | /// |---|---|---|---|---| |
576 | | /// |0xF4|0x07|0x00|false|0x00| |
577 | | /// |
578 | | /// ``` |
579 | | /// # use crc_any::CRC; |
580 | | /// let mut crc = CRC::crc8(); |
581 | | /// crc.digest(b"123456789"); |
582 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0xF4\", &crc.to_string());")] |
583 | | /// ``` |
584 | | #[inline] |
585 | 0 | pub fn crc8() -> CRC { |
586 | 0 | CRC::CRCu8(CRCu8::crc8()) |
587 | 0 | } |
588 | | |
589 | | /// |Check|Poly|Init|Ref|XorOut| |
590 | | /// |---|---|---|---|---| |
591 | | /// |0xDA|0x9B|0xFF|false|0x00| |
592 | | /// |
593 | | /// ``` |
594 | | /// # use crc_any::CRC; |
595 | | /// let mut crc = CRC::crc8cdma2000(); |
596 | | /// crc.digest(b"123456789"); |
597 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0xDA\", &crc.to_string());")] |
598 | | /// ``` |
599 | | #[inline] |
600 | 0 | pub fn crc8cdma2000() -> CRC { |
601 | 0 | CRC::CRCu8(CRCu8::crc8cdma2000()) |
602 | 0 | } |
603 | | |
604 | | /// |Check|Poly|Init|Ref|XorOut| |
605 | | /// |---|---|---|---|---| |
606 | | /// |0xDA|0x39 (rev: 0x9C)|0x00|true|0x00| |
607 | | /// |
608 | | /// ``` |
609 | | /// # use crc_any::CRC; |
610 | | /// let mut crc = CRC::crc8darc(); |
611 | | /// crc.digest(b"123456789"); |
612 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x15\", &crc.to_string());")] |
613 | | /// ``` |
614 | | #[inline] |
615 | 0 | pub fn crc8darc() -> CRC { |
616 | 0 | CRC::CRCu8(CRCu8::crc8darc()) |
617 | 0 | } |
618 | | |
619 | | /// |Check|Poly|Init|Ref|XorOut| |
620 | | /// |---|---|---|---|---| |
621 | | /// |0xBC|0xD5|0x00|false|0x00| |
622 | | /// |
623 | | /// ``` |
624 | | /// # use crc_any::CRC; |
625 | | /// let mut crc = CRC::crc8dvb_s2(); |
626 | | /// crc.digest(b"123456789"); |
627 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0xBC\", &crc.to_string());")] |
628 | | /// ``` |
629 | | #[inline] |
630 | 0 | pub fn crc8dvb_s2() -> CRC { |
631 | 0 | CRC::CRCu8(CRCu8::crc8dvb_s2()) |
632 | 0 | } |
633 | | |
634 | | /// |Check|Poly|Init|Ref|XorOut| |
635 | | /// |---|---|---|---|---| |
636 | | /// |0x97|0x1D (rev: 0xB8)|0xFF|true|0x00| |
637 | | /// |
638 | | /// ``` |
639 | | /// # use crc_any::CRC; |
640 | | /// let mut crc = CRC::crc8ebu(); |
641 | | /// crc.digest(b"123456789"); |
642 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x97\", &crc.to_string());")] |
643 | | /// ``` |
644 | | #[inline] |
645 | 0 | pub fn crc8ebu() -> CRC { |
646 | 0 | CRC::CRCu8(CRCu8::crc8ebu()) |
647 | 0 | } |
648 | | |
649 | | /// |Check|Poly|Init|Ref|XorOut| |
650 | | /// |---|---|---|---|---| |
651 | | /// |0x7E|0x1D|0xFD|false|0x00| |
652 | | /// |
653 | | /// ``` |
654 | | /// # use crc_any::CRC; |
655 | | /// let mut crc = CRC::crc8icode(); |
656 | | /// crc.digest(b"123456789"); |
657 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x7E\", &crc.to_string());")] |
658 | | /// ``` |
659 | | #[inline] |
660 | 0 | pub fn crc8icode() -> CRC { |
661 | 0 | CRC::CRCu8(CRCu8::crc8icode()) |
662 | 0 | } |
663 | | |
664 | | /// |Check|Poly|Init|Ref|XorOut| |
665 | | /// |---|---|---|---|---| |
666 | | /// |0xA1|0x07|0x00|false|0x55| |
667 | | /// |
668 | | /// ``` |
669 | | /// # use crc_any::CRC; |
670 | | /// let mut crc = CRC::crc8itu(); |
671 | | /// crc.digest(b"123456789"); |
672 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0xA1\", &crc.to_string());")] |
673 | | /// ``` |
674 | | #[inline] |
675 | 0 | pub fn crc8itu() -> CRC { |
676 | 0 | CRC::CRCu8(CRCu8::crc8itu()) |
677 | 0 | } |
678 | | |
679 | | /// |Check|Poly|Init|Ref|XorOut| |
680 | | /// |---|---|---|---|---| |
681 | | /// |0xA1|0x31 (rev: 0x8C)|0x00|true|0x00| |
682 | | /// |
683 | | /// ``` |
684 | | /// # use crc_any::CRC; |
685 | | /// let mut crc = CRC::crc8maxim(); |
686 | | /// crc.digest(b"123456789"); |
687 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0xA1\", &crc.to_string());")] |
688 | | /// ``` |
689 | | #[inline] |
690 | 0 | pub fn crc8maxim() -> CRC { |
691 | 0 | CRC::CRCu8(CRCu8::crc8maxim()) |
692 | 0 | } |
693 | | |
694 | | /// |Check|Poly|Init|Ref|XorOut| |
695 | | /// |---|---|---|---|---| |
696 | | /// |0xD0|0x07 (rev: 0xE0)|0xFF|true|0x00| |
697 | | /// |
698 | | /// ``` |
699 | | /// # use crc_any::CRC; |
700 | | /// let mut crc = CRC::crc8rohc(); |
701 | | /// crc.digest(b"123456789"); |
702 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0xD0\", &crc.to_string());")] |
703 | | /// ``` |
704 | | #[inline] |
705 | 0 | pub fn crc8rohc() -> CRC { |
706 | 0 | CRC::CRCu8(CRCu8::crc8rohc()) |
707 | 0 | } |
708 | | |
709 | | /// |Check|Poly|Init|Ref|XorOut| |
710 | | /// |---|---|---|---|---| |
711 | | /// |0x25|0x9B (rev: 0xD9)|0x00|true|0x00| |
712 | | /// |
713 | | /// ``` |
714 | | /// # use crc_any::CRC; |
715 | | /// let mut crc = CRC::crc8wcdma(); |
716 | | /// crc.digest(b"123456789"); |
717 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x25\", &crc.to_string());")] |
718 | | /// ``` |
719 | | #[inline] |
720 | 0 | pub fn crc8wcdma() -> CRC { |
721 | 0 | CRC::CRCu8(CRCu8::crc8wcdma()) |
722 | 0 | } |
723 | | |
724 | | // TODO: CRC-10 |
725 | | |
726 | | /// |Check|Poly|Init|Ref|XorOut| |
727 | | /// |---|---|---|---|---| |
728 | | /// |0x199|0x233|0x000|false|0x000| |
729 | | /// |
730 | | /// ``` |
731 | | /// # use crc_any::CRC; |
732 | | /// let mut crc = CRC::crc10(); |
733 | | /// crc.digest(b"123456789"); |
734 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x199\", &crc.to_string());")] |
735 | | /// ``` |
736 | | #[inline] |
737 | 0 | pub fn crc10() -> CRC { |
738 | 0 | CRC::CRCu16(CRCu16::crc10()) |
739 | 0 | } |
740 | | |
741 | | /// |Check|Poly|Init|Ref|XorOut| |
742 | | /// |---|---|---|---|---| |
743 | | /// |0x233|0x3D9|0x3FF|false|0x000| |
744 | | /// |
745 | | /// ``` |
746 | | /// # use crc_any::CRC; |
747 | | /// let mut crc = CRC::crc10cdma2000(); |
748 | | /// crc.digest(b"123456789"); |
749 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x233\", &crc.to_string());")] |
750 | | /// ``` |
751 | | #[inline] |
752 | 0 | pub fn crc10cdma2000() -> CRC { |
753 | 0 | CRC::CRCu16(CRCu16::crc10cdma2000()) |
754 | 0 | } |
755 | | |
756 | | /// |Check|Poly|Init|Ref|XorOut| |
757 | | /// |---|---|---|---|---| |
758 | | /// |0x12A|0x175|0x000|false|0x3FF| |
759 | | /// |
760 | | /// ``` |
761 | | /// # use crc_any::CRC; |
762 | | /// let mut crc = CRC::crc10gsm(); |
763 | | /// crc.digest(b"123456789"); |
764 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x12A\", &crc.to_string());")] |
765 | | /// ``` |
766 | | #[inline] |
767 | 0 | pub fn crc10gsm() -> CRC { |
768 | 0 | CRC::CRCu16(CRCu16::crc10gsm()) |
769 | 0 | } |
770 | | |
771 | | // TODO: CRC-11 |
772 | | |
773 | | /// |Check|Poly|Init|Ref|XorOut| |
774 | | /// |---|---|---|---|---| |
775 | | /// |0x5A3|0x385|0x01a|false|0x000| |
776 | | /// |
777 | | /// ``` |
778 | | /// # use crc_any::CRC; |
779 | | /// let mut crc = CRC::crc11(); |
780 | | /// crc.digest(b"123456789"); |
781 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x5A3\", &crc.to_string());")] |
782 | | /// ``` |
783 | | #[inline] |
784 | 0 | pub fn crc11() -> CRC { |
785 | 0 | CRC::CRCu16(CRCu16::crc11()) |
786 | 0 | } |
787 | | |
788 | | // TODO: CRC-12 |
789 | | |
790 | | /// |Check|Poly|Init|Ref|XorOut| |
791 | | /// |---|---|---|---|---| |
792 | | /// |0xF5B|0x080F|0x0000|false|0x0000| |
793 | | /// |
794 | | /// ``` |
795 | | /// # use crc_any::CRC; |
796 | | /// let mut crc = CRC::crc12(); |
797 | | /// crc.digest(b"123456789"); |
798 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0xF5B\", &crc.to_string());")] |
799 | | /// ``` |
800 | | #[inline] |
801 | 0 | pub fn crc12() -> CRC { |
802 | 0 | CRC::CRCu16(CRCu16::crc12()) |
803 | 0 | } |
804 | | |
805 | | /// |Check|Poly|Init|Ref|XorOut| |
806 | | /// |---|---|---|---|---| |
807 | | /// |0xD4D|0x0F13|0x0FFF|false|0x0000| |
808 | | /// |
809 | | /// ``` |
810 | | /// # use crc_any::CRC; |
811 | | /// let mut crc = CRC::crc12cdma2000(); |
812 | | /// crc.digest(b"123456789"); |
813 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0xD4D\", &crc.to_string());")] |
814 | | /// ``` |
815 | | #[inline] |
816 | 0 | pub fn crc12cdma2000() -> CRC { |
817 | 0 | CRC::CRCu16(CRCu16::crc12cdma2000()) |
818 | 0 | } |
819 | | |
820 | | /// |Check|Poly|Init|Ref|XorOut| |
821 | | /// |---|---|---|---|---| |
822 | | /// |0xB34|0x0D31|0x0000|false|0x0FFF| |
823 | | /// |
824 | | /// ``` |
825 | | /// # use crc_any::CRC; |
826 | | /// let mut crc = CRC::crc12gsm(); |
827 | | /// crc.digest(b"123456789"); |
828 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0xB34\", &crc.to_string());")] |
829 | | /// ``` |
830 | | #[inline] |
831 | 0 | pub fn crc12gsm() -> CRC { |
832 | 0 | CRC::CRCu16(CRCu16::crc12gsm()) |
833 | 0 | } |
834 | | |
835 | | // TODO: CRC-13 |
836 | | |
837 | | /// |Check|Poly|Init|Ref|XorOut| |
838 | | /// |---|---|---|---|---| |
839 | | /// |0x04FA|0x1CF5|0x0000|false|0x0000| |
840 | | /// |
841 | | /// ``` |
842 | | /// # use crc_any::CRC; |
843 | | /// let mut crc = CRC::crc13bbc(); |
844 | | /// crc.digest(b"123456789"); |
845 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x04FA\", &crc.to_string());")] |
846 | | /// ``` |
847 | | #[inline] |
848 | 0 | pub fn crc13bbc() -> CRC { |
849 | 0 | CRC::CRCu16(CRCu16::crc13bbc()) |
850 | 0 | } |
851 | | |
852 | | // TODO: CRC-14 |
853 | | |
854 | | /// |Check|Poly|Init|Ref|XorOut| |
855 | | /// |---|---|---|---|---| |
856 | | /// |0x082D|0x0805 (rev: 0x2804)|0x0000|true|0x0000| |
857 | | /// |
858 | | /// ``` |
859 | | /// # use crc_any::CRC; |
860 | | /// let mut crc = CRC::crc14darc(); |
861 | | /// crc.digest(b"123456789"); |
862 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x082D\", &crc.to_string());")] |
863 | | /// ``` |
864 | | #[inline] |
865 | 0 | pub fn crc14darc() -> CRC { |
866 | 0 | CRC::CRCu16(CRCu16::crc14darc()) |
867 | 0 | } |
868 | | |
869 | | /// |Check|Poly|Init|Ref|XorOut| |
870 | | /// |---|---|---|---|---| |
871 | | /// |0x30AE|0x202D|0x0000|false|0x3FFF| |
872 | | /// |
873 | | /// ``` |
874 | | /// # use crc_any::CRC; |
875 | | /// let mut crc = CRC::crc14gsm(); |
876 | | /// crc.digest(b"123456789"); |
877 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x30AE\", &crc.to_string());")] |
878 | | /// ``` |
879 | | #[inline] |
880 | 0 | pub fn crc14gsm() -> CRC { |
881 | 0 | CRC::CRCu16(CRCu16::crc14gsm()) |
882 | 0 | } |
883 | | |
884 | | // TODO: CRC-15 |
885 | | |
886 | | /// |Check|Poly|Init|Ref|XorOut| |
887 | | /// |---|---|---|---|---| |
888 | | /// |0x059E|0x4599|0x0000|false|0x0000| |
889 | | /// |
890 | | /// ``` |
891 | | /// # use crc_any::CRC; |
892 | | /// let mut crc = CRC::crc15can(); |
893 | | /// crc.digest(b"123456789"); |
894 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x059E\", &crc.to_string());")] |
895 | | /// ``` |
896 | | #[inline] |
897 | 0 | pub fn crc15can() -> CRC { |
898 | 0 | CRC::CRCu16(CRCu16::crc15can()) |
899 | 0 | } |
900 | | |
901 | | /// |Check|Poly|Init|Ref|XorOut| |
902 | | /// |---|---|---|---|---| |
903 | | /// |0x2566|0x6815|0x0000|false|0x0001| |
904 | | /// |
905 | | /// ``` |
906 | | /// # use crc_any::CRC; |
907 | | /// let mut crc = CRC::crc15mpt1327(); |
908 | | /// crc.digest(b"123456789"); |
909 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x2566\", &crc.to_string());")] |
910 | | /// ``` |
911 | | #[inline] |
912 | 0 | pub fn crc15mpt1327() -> CRC { |
913 | 0 | CRC::CRCu16(CRCu16::crc15mpt1327()) |
914 | 0 | } |
915 | | |
916 | | // TODO: CRC-16 |
917 | | |
918 | | /// |Check|Poly|Init|Ref|XorOut| |
919 | | /// |---|---|---|---|---| |
920 | | /// |0xBB3D|0x8005 (rev: 0xA001)|0x0000|true|0x0000| |
921 | | /// |
922 | | /// ``` |
923 | | /// # use crc_any::CRC; |
924 | | /// let mut crc = CRC::crc16(); |
925 | | /// crc.digest(b"123456789"); |
926 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0xBB3D\", &crc.to_string());")] |
927 | | /// ``` |
928 | | #[inline] |
929 | 0 | pub fn crc16() -> CRC { |
930 | 0 | CRC::CRCu16(CRCu16::crc16()) |
931 | 0 | } |
932 | | |
933 | | /// |Check|Poly|Init|Ref|XorOut| |
934 | | /// |---|---|---|---|---| |
935 | | /// |0x29B1|0x1021|0xFFFF|false|0x0000| |
936 | | /// |
937 | | /// ``` |
938 | | /// # use crc_any::CRC; |
939 | | /// let mut crc = CRC::crc16ccitt_false(); |
940 | | /// crc.digest(b"123456789"); |
941 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x29B1\", &crc.to_string());")] |
942 | | /// ``` |
943 | | #[inline] |
944 | 0 | pub fn crc16ccitt_false() -> CRC { |
945 | 0 | CRC::CRCu16(CRCu16::crc16ccitt_false()) |
946 | 0 | } |
947 | | |
948 | | /// |Check|Poly|Init|Ref|XorOut| |
949 | | /// |---|---|---|---|---| |
950 | | /// |0xE5CC|0x1021|0x1D0F|false|0x0000| |
951 | | /// |
952 | | /// ``` |
953 | | /// # use crc_any::CRC; |
954 | | /// let mut crc = CRC::crc16aug_ccitt(); |
955 | | /// crc.digest(b"123456789"); |
956 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0xE5CC\", &crc.to_string());")] |
957 | | /// ``` |
958 | | #[inline] |
959 | 0 | pub fn crc16aug_ccitt() -> CRC { |
960 | 0 | CRC::CRCu16(CRCu16::crc16aug_ccitt()) |
961 | 0 | } |
962 | | |
963 | | /// |Check|Poly|Init|Ref|XorOut| |
964 | | /// |---|---|---|---|---| |
965 | | /// |0xFEE8|0x8005|0x0000|false|0x0000| |
966 | | /// |
967 | | /// ``` |
968 | | /// # use crc_any::CRC; |
969 | | /// let mut crc = CRC::crc16buypass(); |
970 | | /// crc.digest(b"123456789"); |
971 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0xFEE8\", &crc.to_string());")] |
972 | | /// ``` |
973 | | #[inline] |
974 | 0 | pub fn crc16buypass() -> CRC { |
975 | 0 | CRC::CRCu16(CRCu16::crc16buypass()) |
976 | 0 | } |
977 | | |
978 | | /// |Check|Poly|Init|Ref|XorOut| |
979 | | /// |---|---|---|---|---| |
980 | | /// |0x4C06|0xC867|0xFFFF|false|0x0000| |
981 | | /// |
982 | | /// ``` |
983 | | /// # use crc_any::CRC; |
984 | | /// let mut crc = CRC::crc16cdma2000(); |
985 | | /// crc.digest(b"123456789"); |
986 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x4C06\", &crc.to_string());")] |
987 | | /// ``` |
988 | | #[inline] |
989 | 0 | pub fn crc16cdma2000() -> CRC { |
990 | 0 | CRC::CRCu16(CRCu16::crc16cdma2000()) |
991 | 0 | } |
992 | | |
993 | | /// |Check|Poly|Init|Ref|XorOut| |
994 | | /// |---|---|---|---|---| |
995 | | /// |0x9ECF|0x8005|0x800D|false|0x0000| |
996 | | /// |
997 | | /// ``` |
998 | | /// # use crc_any::CRC; |
999 | | /// let mut crc = CRC::crc16dds_110(); |
1000 | | /// crc.digest(b"123456789"); |
1001 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x9ECF\", &crc.to_string());")] |
1002 | | /// ``` |
1003 | | #[inline] |
1004 | 0 | pub fn crc16dds_110() -> CRC { |
1005 | 0 | CRC::CRCu16(CRCu16::crc16dds_110()) |
1006 | 0 | } |
1007 | | |
1008 | | /// |Check|Poly|Init|Ref|XorOut| |
1009 | | /// |---|---|---|---|---| |
1010 | | /// |0x007E|0x0589|0x0000|false|0x0001| |
1011 | | /// |
1012 | | /// ``` |
1013 | | /// # use crc_any::CRC; |
1014 | | /// let mut crc = CRC::crc16dect_r(); |
1015 | | /// crc.digest(b"123456789"); |
1016 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x007E\", &crc.to_string());")] |
1017 | | /// ``` |
1018 | | #[inline] |
1019 | 0 | pub fn crc16dect_r() -> CRC { |
1020 | 0 | CRC::CRCu16(CRCu16::crc16dect_r()) |
1021 | 0 | } |
1022 | | |
1023 | | /// |Check|Poly|Init|Ref|XorOut| |
1024 | | /// |---|---|---|---|---| |
1025 | | /// |0x007F|0x0589|0x0000|false|0x0000| |
1026 | | /// |
1027 | | /// ``` |
1028 | | /// # use crc_any::CRC; |
1029 | | /// let mut crc = CRC::crc16dect_r(); |
1030 | | /// crc.digest(b"123456789"); |
1031 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x007E\", &crc.to_string());")] |
1032 | | /// ``` |
1033 | | #[inline] |
1034 | 0 | pub fn crc16dect_x() -> CRC { |
1035 | 0 | CRC::CRCu16(CRCu16::crc16dect_x()) |
1036 | 0 | } |
1037 | | |
1038 | | /// |Check|Poly|Init|Ref|XorOut| |
1039 | | /// |---|---|---|---|---| |
1040 | | /// |0xEA82|0x3D65 (rev: 0xA6BC)|0x0000|true|0xFFFF| |
1041 | | /// |
1042 | | /// ``` |
1043 | | /// # use crc_any::CRC; |
1044 | | /// let mut crc = CRC::crc16dnp(); |
1045 | | /// crc.digest(b"123456789"); |
1046 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0xEA82\", &crc.to_string());")] |
1047 | | /// ``` |
1048 | | #[inline] |
1049 | 0 | pub fn crc16dnp() -> CRC { |
1050 | 0 | CRC::CRCu16(CRCu16::crc16dnp()) |
1051 | 0 | } |
1052 | | |
1053 | | /// |Check|Poly|Init|Ref|XorOut| |
1054 | | /// |---|---|---|---|---| |
1055 | | /// |0xC2B7|0x3D65|0x0000|false|0xFFFF| |
1056 | | /// |
1057 | | /// ``` |
1058 | | /// # use crc_any::CRC; |
1059 | | /// let mut crc = CRC::crc16en_13757(); |
1060 | | /// crc.digest(b"123456789"); |
1061 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0xC2B7\", &crc.to_string());")] |
1062 | | /// ``` |
1063 | | #[inline] |
1064 | 0 | pub fn crc16en_13757() -> CRC { |
1065 | 0 | CRC::CRCu16(CRCu16::crc16en_13757()) |
1066 | 0 | } |
1067 | | |
1068 | | /// |Check|Poly|Init|Ref|XorOut| |
1069 | | /// |---|---|---|---|---| |
1070 | | /// |0xD64E|0x1021|0xFFFF|false|0xFFFF| |
1071 | | /// |
1072 | | /// ``` |
1073 | | /// # use crc_any::CRC; |
1074 | | /// let mut crc = CRC::crc16genibus(); |
1075 | | /// crc.digest(b"123456789"); |
1076 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0xD64E\", &crc.to_string());")] |
1077 | | /// ``` |
1078 | | #[inline] |
1079 | 0 | pub fn crc16genibus() -> CRC { |
1080 | 0 | CRC::CRCu16(CRCu16::crc16genibus()) |
1081 | 0 | } |
1082 | | |
1083 | | /// |Check|Poly|Init|Ref|XorOut| |
1084 | | /// |---|---|---|---|---| |
1085 | | /// |0x44C2|0x8005 (rev: 0xA001)|0xFFFF|true|0xFFFF| |
1086 | | /// |
1087 | | /// ``` |
1088 | | /// # use crc_any::CRC; |
1089 | | /// let mut crc = CRC::crc16maxim(); |
1090 | | /// crc.digest(b"123456789"); |
1091 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x44C2\", &crc.to_string());")] |
1092 | | /// ``` |
1093 | | #[inline] |
1094 | 0 | pub fn crc16maxim() -> CRC { |
1095 | 0 | CRC::CRCu16(CRCu16::crc16maxim()) |
1096 | 0 | } |
1097 | | |
1098 | | /// |Check|Poly|Init|Ref|XorOut| |
1099 | | /// |---|---|---|---|---| |
1100 | | /// |0x6F91|0x1021 (rev: 0x8408)|0xFFFF|true|0x0000| |
1101 | | /// |
1102 | | /// ``` |
1103 | | /// # use crc_any::CRC; |
1104 | | /// let mut crc = CRC::crc16mcrf4cc(); |
1105 | | /// crc.digest(b"123456789"); |
1106 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x6F91\", &crc.to_string());")] |
1107 | | /// ``` |
1108 | | #[inline] |
1109 | 0 | pub fn crc16mcrf4cc() -> CRC { |
1110 | 0 | CRC::CRCu16(CRCu16::crc16mcrf4cc()) |
1111 | 0 | } |
1112 | | |
1113 | | /// |Check|Poly|Init|Ref|XorOut| |
1114 | | /// |---|---|---|---|---| |
1115 | | /// |0x63D0|0x1021 (rev: 0x8408)|0xB2AA|true|0x0000| |
1116 | | /// |
1117 | | /// ``` |
1118 | | /// # use crc_any::CRC; |
1119 | | /// let mut crc = CRC::crc16riello(); |
1120 | | /// crc.digest(b"123456789"); |
1121 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x63D0\", &crc.to_string());")] |
1122 | | /// ``` |
1123 | | #[inline] |
1124 | 0 | pub fn crc16riello() -> CRC { |
1125 | 0 | CRC::CRCu16(CRCu16::crc16riello()) |
1126 | 0 | } |
1127 | | |
1128 | | /// |Check|Poly|Init|Ref|XorOut| |
1129 | | /// |---|---|---|---|---| |
1130 | | /// |0xD0DB|0x8BB7|0x0000|false|0x0000| |
1131 | | /// |
1132 | | /// ``` |
1133 | | /// # use crc_any::CRC; |
1134 | | /// let mut crc = CRC::crc16t10_dif(); |
1135 | | /// crc.digest(b"123456789"); |
1136 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0xD0DB\", &crc.to_string());")] |
1137 | | /// ``` |
1138 | | #[inline] |
1139 | 0 | pub fn crc16t10_dif() -> CRC { |
1140 | 0 | CRC::CRCu16(CRCu16::crc16t10_dif()) |
1141 | 0 | } |
1142 | | |
1143 | | /// |Check|Poly|Init|Ref|XorOut| |
1144 | | /// |---|---|---|---|---| |
1145 | | /// |0x0FB3|0xA097|0x0000|false|0x0000| |
1146 | | /// |
1147 | | /// ``` |
1148 | | /// # use crc_any::CRC; |
1149 | | /// let mut crc = CRC::crc16teledisk(); |
1150 | | /// crc.digest(b"123456789"); |
1151 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x0FB3\", &crc.to_string());")] |
1152 | | /// ``` |
1153 | | #[inline] |
1154 | 0 | pub fn crc16teledisk() -> CRC { |
1155 | 0 | CRC::CRCu16(CRCu16::crc16teledisk()) |
1156 | 0 | } |
1157 | | |
1158 | | /// |Check|Poly|Init|Ref|XorOut| |
1159 | | /// |---|---|---|---|---| |
1160 | | /// |0x26B1|0x1021 (rev: 0x8408)|0x89EC|true|0x0000| |
1161 | | /// |
1162 | | /// ``` |
1163 | | /// # use crc_any::CRC; |
1164 | | /// let mut crc = CRC::crc16tms13157(); |
1165 | | /// crc.digest(b"123456789"); |
1166 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x26B1\", &crc.to_string());")] |
1167 | | /// ``` |
1168 | | #[inline] |
1169 | 0 | pub fn crc16tms13157() -> CRC { |
1170 | 0 | CRC::CRCu16(CRCu16::crc16tms13157()) |
1171 | 0 | } |
1172 | | |
1173 | | /// |Check|Poly|Init|Ref|XorOut| |
1174 | | /// |---|---|---|---|---| |
1175 | | /// |0xB4C8|0x8005 (rev: 0xA001)|0xFFFF|true|0xFFFF| |
1176 | | /// |
1177 | | /// ``` |
1178 | | /// # use crc_any::CRC; |
1179 | | /// let mut crc = CRC::crc16usb(); |
1180 | | /// crc.digest(b"123456789"); |
1181 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0xB4C8\", &crc.to_string());")] |
1182 | | /// ``` |
1183 | | #[inline] |
1184 | 0 | pub fn crc16usb() -> CRC { |
1185 | 0 | CRC::CRCu16(CRCu16::crc16usb()) |
1186 | 0 | } |
1187 | | |
1188 | | /// |Check|Poly|Init|Ref|XorOut| |
1189 | | /// |---|---|---|---|---| |
1190 | | /// |0xBF05|0x1021 (rev: 0x8408)|0xC6C6|true|0x0000| |
1191 | | /// |
1192 | | /// ``` |
1193 | | /// # use crc_any::CRC; |
1194 | | /// let mut crc = CRC::crc_a(); |
1195 | | /// crc.digest(b"123456789"); |
1196 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0xBF05\", &crc.to_string());")] |
1197 | | /// ``` |
1198 | | #[inline] |
1199 | 0 | pub fn crc_a() -> CRC { |
1200 | 0 | CRC::CRCu16(CRCu16::crc_a()) |
1201 | 0 | } |
1202 | | |
1203 | | /// |Check|Poly|Init|Ref|XorOut| |
1204 | | /// |---|---|---|---|---| |
1205 | | /// |0x2189|0x1021 (rev: 0x8408)|0x0000|true|0x0000| |
1206 | | /// |
1207 | | /// ``` |
1208 | | /// # use crc_any::CRC; |
1209 | | /// let mut crc = CRC::crc16kermit(); |
1210 | | /// crc.digest(b"123456789"); |
1211 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x2189\", &crc.to_string());")] |
1212 | | /// ``` |
1213 | | #[inline] |
1214 | 0 | pub fn crc16kermit() -> CRC { |
1215 | 0 | CRC::CRCu16(CRCu16::crc16kermit()) |
1216 | 0 | } |
1217 | | |
1218 | | /// |Check|Poly|Init|Ref|XorOut| |
1219 | | /// |---|---|---|---|---| |
1220 | | /// |0x4B37|0x8005 (rev: 0xA001)|0xFFFF|true|0x0000| |
1221 | | /// |
1222 | | /// ``` |
1223 | | /// # use crc_any::CRC; |
1224 | | /// let mut crc = CRC::crc16modbus(); |
1225 | | /// crc.digest(b"123456789"); |
1226 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x4B37\", &crc.to_string());")] |
1227 | | /// ``` |
1228 | | #[inline] |
1229 | 0 | pub fn crc16modbus() -> CRC { |
1230 | 0 | CRC::CRCu16(CRCu16::crc16modbus()) |
1231 | 0 | } |
1232 | | |
1233 | | /// |Check|Poly|Init|Ref|XorOut| |
1234 | | /// |---|---|---|---|---| |
1235 | | /// |0x906E|0x8005 (rev: 0xA001)|0xFFFF|true|0xFFFF| |
1236 | | /// |
1237 | | /// ``` |
1238 | | /// # use crc_any::CRC; |
1239 | | /// let mut crc = CRC::crc16_x25(); |
1240 | | /// crc.digest(b"123456789"); |
1241 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x906E\", &crc.to_string());")] |
1242 | | /// ``` |
1243 | | #[inline] |
1244 | 0 | pub fn crc16_x25() -> CRC { |
1245 | 0 | CRC::CRCu16(CRCu16::crc16_x25()) |
1246 | 0 | } |
1247 | | |
1248 | | /// |Check|Poly|Init|Ref|XorOut| |
1249 | | /// |---|---|---|---|---| |
1250 | | /// |0x31C3|0x1021|0x0000|false|0x0000| |
1251 | | /// |
1252 | | /// ``` |
1253 | | /// # use crc_any::CRC; |
1254 | | /// let mut crc = CRC::crc16xmodem(); |
1255 | | /// crc.digest(b"123456789"); |
1256 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x31C3\", &crc.to_string());")] |
1257 | | /// ``` |
1258 | | #[inline] |
1259 | 0 | pub fn crc16xmodem() -> CRC { |
1260 | 0 | CRC::CRCu16(CRCu16::crc16xmodem()) |
1261 | 0 | } |
1262 | | |
1263 | | // TODO: CRC-17 |
1264 | | |
1265 | | /// |Check|Poly|Init|Ref|XorOut| |
1266 | | /// |---|---|---|---|---| |
1267 | | /// |0x04F03|0x1685B|0x00000|false|0x00000| |
1268 | | /// |
1269 | | /// ``` |
1270 | | /// # use crc_any::CRC; |
1271 | | /// let mut crc = CRC::crc17can(); |
1272 | | /// crc.digest(b"123456789"); |
1273 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x04F03\", &crc.to_string());")] |
1274 | | /// ``` |
1275 | | #[inline] |
1276 | 0 | pub fn crc17can() -> CRC { |
1277 | 0 | CRC::CRCu32(CRCu32::crc17can()) |
1278 | 0 | } |
1279 | | |
1280 | | // TODO: CRC-21 |
1281 | | |
1282 | | /// |Check|Poly|Init|Ref|XorOut| |
1283 | | /// |---|---|---|---|---| |
1284 | | /// |0x0ED841|0x102899|0x000000|false|0x000000| |
1285 | | /// |
1286 | | /// ``` |
1287 | | /// # use crc_any::CRC; |
1288 | | /// let mut crc = CRC::crc21can(); |
1289 | | /// crc.digest(b"123456789"); |
1290 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x0ED841\", &crc.to_string());")] |
1291 | | /// ``` |
1292 | | #[inline] |
1293 | 0 | pub fn crc21can() -> CRC { |
1294 | 0 | CRC::CRCu32(CRCu32::crc21can()) |
1295 | 0 | } |
1296 | | |
1297 | | // TODO: CRC-24 |
1298 | | |
1299 | | /// |Check|Poly|Init|Ref|XorOut| |
1300 | | /// |---|---|---|---|---| |
1301 | | /// |0x21CF02|0x864CFB|0xB704CE|false|0x000000| |
1302 | | /// |
1303 | | /// ``` |
1304 | | /// # use crc_any::CRC; |
1305 | | /// let mut crc = CRC::crc24(); |
1306 | | /// crc.digest(b"123456789"); |
1307 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x21CF02\", &crc.to_string());")] |
1308 | | /// ``` |
1309 | | #[inline] |
1310 | 0 | pub fn crc24() -> CRC { |
1311 | 0 | CRC::CRCu32(CRCu32::crc24()) |
1312 | 0 | } |
1313 | | |
1314 | | /// |Check|Poly|Init|Ref|XorOut| |
1315 | | /// |---|---|---|---|---| |
1316 | | /// |0xC25A56|0x00065B (rev: 0xDA6000)|0x555555|true|0x000000| |
1317 | | /// |
1318 | | /// ``` |
1319 | | /// # use crc_any::CRC; |
1320 | | /// let mut crc = CRC::crc24ble(); |
1321 | | /// crc.digest(b"123456789"); |
1322 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0xC25A56\", &crc.to_string());")] |
1323 | | /// ``` |
1324 | | #[inline] |
1325 | 0 | pub fn crc24ble() -> CRC { |
1326 | 0 | CRC::CRCu32(CRCu32::crc24ble()) |
1327 | 0 | } |
1328 | | |
1329 | | /// |Check|Poly|Init|Ref|XorOut| |
1330 | | /// |---|---|---|---|---| |
1331 | | /// |0x7979BD|0x5D6DCB|0xFEDCBA|false|0x000000| |
1332 | | /// |
1333 | | /// ``` |
1334 | | /// # use crc_any::CRC; |
1335 | | /// let mut crc = CRC::crc24flexray_a(); |
1336 | | /// crc.digest(b"123456789"); |
1337 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x7979BD\", &crc.to_string());")] |
1338 | | /// ``` |
1339 | | #[inline] |
1340 | 0 | pub fn crc24flexray_a() -> CRC { |
1341 | 0 | CRC::CRCu32(CRCu32::crc24flexray_a()) |
1342 | 0 | } |
1343 | | |
1344 | | /// |Check|Poly|Init|Ref|XorOut| |
1345 | | /// |---|---|---|---|---| |
1346 | | /// |0x1F23B8|0x5D6DCB|0xABCDEF|false|0x000000| |
1347 | | /// |
1348 | | /// ``` |
1349 | | /// # use crc_any::CRC; |
1350 | | /// let mut crc = CRC::crc24flexray_b(); |
1351 | | /// crc.digest(b"123456789"); |
1352 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x1F23B8\", &crc.to_string());")] |
1353 | | /// ``` |
1354 | | #[inline] |
1355 | 0 | pub fn crc24flexray_b() -> CRC { |
1356 | 0 | CRC::CRCu32(CRCu32::crc24flexray_b()) |
1357 | 0 | } |
1358 | | |
1359 | | /// |Check|Poly|Init|Ref|XorOut| |
1360 | | /// |---|---|---|---|---| |
1361 | | /// |0xCDE703|0x864CFB|0x000000|false|0x000000| |
1362 | | /// |
1363 | | /// ``` |
1364 | | /// # use crc_any::CRC; |
1365 | | /// let mut crc = CRC::crc24lte_a(); |
1366 | | /// crc.digest(b"123456789"); |
1367 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0xCDE703\", &crc.to_string());")] |
1368 | | /// ``` |
1369 | | #[inline] |
1370 | 0 | pub fn crc24lte_a() -> CRC { |
1371 | 0 | CRC::CRCu32(CRCu32::crc24lte_a()) |
1372 | 0 | } |
1373 | | |
1374 | | /// |Check|Poly|Init|Ref|XorOut| |
1375 | | /// |---|---|---|---|---| |
1376 | | /// |0x23EF52|0x800063|0x000000|false|0x000000| |
1377 | | /// |
1378 | | /// ``` |
1379 | | /// # use crc_any::CRC; |
1380 | | /// let mut crc = CRC::crc24lte_b(); |
1381 | | /// crc.digest(b"123456789"); |
1382 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x23EF52\", &crc.to_string());")] |
1383 | | /// ``` |
1384 | | #[inline] |
1385 | 0 | pub fn crc24lte_b() -> CRC { |
1386 | 0 | CRC::CRCu32(CRCu32::crc24lte_b()) |
1387 | 0 | } |
1388 | | |
1389 | | /// |Check|Poly|Init|Ref|XorOut| |
1390 | | /// |---|---|---|---|---| |
1391 | | /// |0x200FA5|0x800063|0xFFFFFF|false|0xFFFFFF| |
1392 | | /// |
1393 | | /// ``` |
1394 | | /// # use crc_any::CRC; |
1395 | | /// let mut crc = CRC::crc24os9(); |
1396 | | /// crc.digest(b"123456789"); |
1397 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x200FA5\", &crc.to_string());")] |
1398 | | /// ``` |
1399 | | #[inline] |
1400 | 0 | pub fn crc24os9() -> CRC { |
1401 | 0 | CRC::CRCu32(CRCu32::crc24os9()) |
1402 | 0 | } |
1403 | | |
1404 | | // TODO: CRC-30 |
1405 | | |
1406 | | /// |Check|Poly|Init|Ref|XorOut| |
1407 | | /// |---|---|---|---|---| |
1408 | | /// |0x04C34ABF|0x2030B9C7|0x3FFFFFFF|false|0x3FFFFFFF| |
1409 | | /// |
1410 | | /// ``` |
1411 | | /// # use crc_any::CRC; |
1412 | | /// let mut crc = CRC::crc30cdma(); |
1413 | | /// crc.digest(b"123456789"); |
1414 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x04C34ABF\", &crc.to_string());")] |
1415 | | /// ``` |
1416 | | #[inline] |
1417 | 0 | pub fn crc30cdma() -> CRC { |
1418 | 0 | CRC::CRCu32(CRCu32::crc30cdma()) |
1419 | 0 | } |
1420 | | |
1421 | | // TODO: CRC-32 |
1422 | | |
1423 | | /// |Check|Poly|Init|Ref|XorOut| |
1424 | | /// |---|---|---|---|---| |
1425 | | /// |0xCBF43926|0x04C11DB7 (rev: 0xEDB88320)|0xFFFFFFFF|true|0xFFFFFFFF| |
1426 | | /// |
1427 | | /// ``` |
1428 | | /// # use crc_any::CRC; |
1429 | | /// let mut crc = CRC::crc32(); |
1430 | | /// crc.digest(b"123456789"); |
1431 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0xCBF43926\", &crc.to_string());")] |
1432 | | /// ``` |
1433 | | #[inline] |
1434 | 0 | pub fn crc32() -> CRC { |
1435 | 0 | CRC::CRCu32(CRCu32::crc32()) |
1436 | 0 | } |
1437 | | |
1438 | | /// |Check|Poly|Init|Ref|XorOut| |
1439 | | /// |---|---|---|---|---| |
1440 | | /// |0x181989FC|0x04C11DB7|0xFFFFFFFF|false|0xFFFFFFFF| |
1441 | | /// |
1442 | | /// **Output will be reversed by bytes.** |
1443 | | /// |
1444 | | /// ``` |
1445 | | /// # use crc_any::CRC; |
1446 | | /// let mut crc = CRC::crc32mhash(); |
1447 | | /// crc.digest(b"123456789"); |
1448 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x181989FC\", &crc.to_string());")] |
1449 | | /// ``` |
1450 | | #[inline] |
1451 | 0 | pub fn crc32mhash() -> CRC { |
1452 | 0 | CRC::CRCu32(CRCu32::crc32mhash()) |
1453 | 0 | } |
1454 | | |
1455 | | /// |Check|Poly|Init|Ref|XorOut| |
1456 | | /// |---|---|---|---|---| |
1457 | | /// |0xFC891918|0x04C11DB7|0xFFFFFFFF|false|0xFFFFFFFF| |
1458 | | /// |
1459 | | /// ``` |
1460 | | /// # use crc_any::CRC; |
1461 | | /// let mut crc = CRC::crc32bzip2(); |
1462 | | /// crc.digest(b"123456789"); |
1463 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0xFC891918\", &crc.to_string());")] |
1464 | | /// ``` |
1465 | | #[inline] |
1466 | 0 | pub fn crc32bzip2() -> CRC { |
1467 | 0 | CRC::CRCu32(CRCu32::crc32bzip2()) |
1468 | 0 | } |
1469 | | |
1470 | | /// |Check|Poly|Init|Ref|XorOut| |
1471 | | /// |---|---|---|---|---| |
1472 | | /// |0xE3069283|0x1EDC6F41 (rev: 0x82F63B78)|0xFFFFFFFF|true|0xFFFFFFFF| |
1473 | | /// |
1474 | | /// ``` |
1475 | | /// # use crc_any::CRC; |
1476 | | /// let mut crc = CRC::crc32c(); |
1477 | | /// crc.digest(b"123456789"); |
1478 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0xE3069283\", &crc.to_string());")] |
1479 | | /// ``` |
1480 | | #[inline] |
1481 | 336 | pub fn crc32c() -> CRC { |
1482 | 336 | CRC::CRCu32(CRCu32::crc32c()) |
1483 | 336 | } Line | Count | Source | 1481 | 336 | pub fn crc32c() -> CRC { | 1482 | 336 | CRC::CRCu32(CRCu32::crc32c()) | 1483 | 336 | } |
Unexecuted instantiation: <crc_any::CRC>::crc32c |
1484 | | |
1485 | | /// |Check|Poly|Init|Ref|XorOut| |
1486 | | /// |---|---|---|---|---| |
1487 | | /// |0x87315576|0xA833982B (rev: 0xD419CC15)|0xFFFFFFFF|true|0xFFFFFFFF| |
1488 | | /// |
1489 | | /// ``` |
1490 | | /// # use crc_any::CRC; |
1491 | | /// let mut crc = CRC::crc32d(); |
1492 | | /// crc.digest(b"123456789"); |
1493 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x87315576\", &crc.to_string());")] |
1494 | | /// ``` |
1495 | | #[inline] |
1496 | 0 | pub fn crc32d() -> CRC { |
1497 | 0 | CRC::CRCu32(CRCu32::crc32d()) |
1498 | 0 | } |
1499 | | |
1500 | | /// |Check|Poly|Init|Ref|XorOut| |
1501 | | /// |---|---|---|---|---| |
1502 | | /// |0x0376E6E7|0x04C11DB7|0xFFFFFFFF|false|0x00000000| |
1503 | | /// |
1504 | | /// ``` |
1505 | | /// # use crc_any::CRC; |
1506 | | /// let mut crc = CRC::crc32mpeg2(); |
1507 | | /// crc.digest(b"123456789"); |
1508 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x0376E6E7\", &crc.to_string());")] |
1509 | | /// ``` |
1510 | | #[inline] |
1511 | 0 | pub fn crc32mpeg2() -> CRC { |
1512 | 0 | CRC::CRCu32(CRCu32::crc32mpeg2()) |
1513 | 0 | } |
1514 | | |
1515 | | /// |Check|Poly|Init|Ref|XorOut| |
1516 | | /// |---|---|---|---|---| |
1517 | | /// |0x765E7680|0x04C11DB7|0x00000000|false|0xFFFFFFFF| |
1518 | | /// |
1519 | | /// ``` |
1520 | | /// # use crc_any::CRC; |
1521 | | /// let mut crc = CRC::crc32posix(); |
1522 | | /// crc.digest(b"123456789"); |
1523 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x765E7680\", &crc.to_string());")] |
1524 | | /// ``` |
1525 | | #[inline] |
1526 | 0 | pub fn crc32posix() -> CRC { |
1527 | 0 | CRC::CRCu32(CRCu32::crc32posix()) |
1528 | 0 | } |
1529 | | |
1530 | | /// |Check|Poly|Init|Ref|XorOut| |
1531 | | /// |---|---|---|---|---| |
1532 | | /// |0x3010BF7F|0x814141AB|0x00000000|false|0x00000000| |
1533 | | /// |
1534 | | /// ``` |
1535 | | /// # use crc_any::CRC; |
1536 | | /// let mut crc = CRC::crc32q(); |
1537 | | /// crc.digest(b"123456789"); |
1538 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x3010BF7F\", &crc.to_string());")] |
1539 | | /// ``` |
1540 | | #[inline] |
1541 | 0 | pub fn crc32q() -> CRC { |
1542 | 0 | CRC::CRCu32(CRCu32::crc32q()) |
1543 | 0 | } |
1544 | | |
1545 | | /// |Check|Poly|Init|Ref|XorOut| |
1546 | | /// |---|---|---|---|---| |
1547 | | /// |0x340BC6D9|0x04C11DB7 (rev: 0xEDB88320)|0x00000000|true|0x00000000| |
1548 | | /// |
1549 | | /// ``` |
1550 | | /// # use crc_any::CRC; |
1551 | | /// let mut crc = CRC::crc32jamcrc(); |
1552 | | /// crc.digest(b"123456789"); |
1553 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x340BC6D9\", &crc.to_string());")] |
1554 | | /// ``` |
1555 | | #[inline] |
1556 | 0 | pub fn crc32jamcrc() -> CRC { |
1557 | 0 | CRC::CRCu32(CRCu32::crc32jamcrc()) |
1558 | 0 | } |
1559 | | |
1560 | | /// |Check|Poly|Init|Ref|XorOut| |
1561 | | /// |---|---|---|---|---| |
1562 | | /// |0xBD0BE338|0x000000AF|0x00000000|false|0x00000000| |
1563 | | /// |
1564 | | /// ``` |
1565 | | /// # use crc_any::CRC; |
1566 | | /// let mut crc = CRC::crc32xfer(); |
1567 | | /// crc.digest(b"123456789"); |
1568 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0xBD0BE338\", &crc.to_string());")] |
1569 | | /// ``` |
1570 | | #[inline] |
1571 | 0 | pub fn crc32xfer() -> CRC { |
1572 | 0 | CRC::CRCu32(CRCu32::crc32xfer()) |
1573 | 0 | } |
1574 | | |
1575 | | // TODO: CRC-40 |
1576 | | |
1577 | | /// |Check|Poly|Init|Ref|XorOut| |
1578 | | /// |---|---|---|---|---| |
1579 | | /// |0xD4164FC646|0x0004820009|0x0000000000|false|0xFFFFFFFFFF| |
1580 | | /// |
1581 | | /// ``` |
1582 | | /// # use crc_any::CRC; |
1583 | | /// let mut crc = CRC::crc40gsm(); |
1584 | | /// crc.digest(b"123456789"); |
1585 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0xD4164FC646\", &crc.to_string());")] |
1586 | | /// ``` |
1587 | | #[inline] |
1588 | 0 | pub fn crc40gsm() -> CRC { |
1589 | 0 | CRC::CRCu64(CRCu64::crc40gsm()) |
1590 | 0 | } |
1591 | | |
1592 | | // TODO: CRC-64 |
1593 | | |
1594 | | /// |Check|Poly|Init|Ref|XorOut| |
1595 | | /// |---|---|---|---|---| |
1596 | | /// |0x6C40DF5F0B497347|0x42F0E1EBA9EA3693|0x0000000000000000|false|0x0000000000000000| |
1597 | | /// |
1598 | | /// ``` |
1599 | | /// # use crc_any::CRC; |
1600 | | /// let mut crc = CRC::crc64(); |
1601 | | /// crc.digest(b"123456789"); |
1602 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x6C40DF5F0B497347\", &crc.to_string());")] |
1603 | | /// ``` |
1604 | | #[inline] |
1605 | 0 | pub fn crc64() -> CRC { |
1606 | 0 | CRC::CRCu64(CRCu64::crc64()) |
1607 | 0 | } |
1608 | | |
1609 | | /// |Check|Poly|Init|Ref|XorOut| |
1610 | | /// |---|---|---|---|---| |
1611 | | /// |0xB90956C775A41001|0x000000000000001B (rev: 0xD800000000000000)|0xFFFFFFFFFFFFFFFF|true|0xFFFFFFFFFFFFFFFF| |
1612 | | /// |
1613 | | /// ``` |
1614 | | /// # use crc_any::CRC; |
1615 | | /// let mut crc = CRC::crc64iso(); |
1616 | | /// crc.digest(b"123456789"); |
1617 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0xB90956C775A41001\", &crc.to_string());")] |
1618 | | /// ``` |
1619 | | #[inline] |
1620 | 0 | pub fn crc64iso() -> CRC { |
1621 | 0 | CRC::CRCu64(CRCu64::crc64iso()) |
1622 | 0 | } |
1623 | | |
1624 | | /// |Check|Poly|Init|Ref|XorOut| |
1625 | | /// |---|---|---|---|---| |
1626 | | /// |0x62EC59E3F1A4F00A|0x42F0E1EBA9EA3693|0xFFFFFFFFFFFFFFFF|false|0xFFFFFFFFFFFFFFFF| |
1627 | | /// |
1628 | | /// ``` |
1629 | | /// # use crc_any::CRC; |
1630 | | /// let mut crc = CRC::crc64we(); |
1631 | | /// crc.digest(b"123456789"); |
1632 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0x62EC59E3F1A4F00A\", &crc.to_string());")] |
1633 | | /// ``` |
1634 | | #[inline] |
1635 | 0 | pub fn crc64we() -> CRC { |
1636 | 0 | CRC::CRCu64(CRCu64::crc64we()) |
1637 | 0 | } |
1638 | | |
1639 | | /// |Check|Poly|Init|Ref|XorOut| |
1640 | | /// |---|---|---|---|---| |
1641 | | /// |0xE9C6D914C4B8D9CA|0xAD93D23594C935A9 (rev: 0x95AC9329AC4BC9B5)|0x0000000000000000|true|0x0000000000000000| |
1642 | | /// |
1643 | | /// ``` |
1644 | | /// # use crc_any::CRC; |
1645 | | /// let mut crc = CRC::crc64jones(); |
1646 | | /// crc.digest(b"123456789"); |
1647 | | #[cfg_attr(feature = "alloc", doc = "assert_eq!(\"0xE9C6D914C4B8D9CA\", &crc.to_string());")] |
1648 | | /// ``` |
1649 | | #[inline] |
1650 | 0 | pub fn crc64jones() -> CRC { |
1651 | 0 | CRC::CRCu64(CRCu64::crc64jones()) |
1652 | 0 | } |
1653 | | } |