pub struct CRCu16 { /* private fields */ }
Expand description
This struct can help you compute a CRC-16 (or CRC-x where x is equal or less than 16
) value.
Implementations§
source§impl CRCu16
impl CRCu16
source§impl CRCu16
impl CRCu16
sourcepub fn get_crc_vec_le(&mut self) -> Vec<u8>
pub fn get_crc_vec_le(&mut self) -> Vec<u8>
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.
sourcepub fn get_crc_vec_be(&mut self) -> Vec<u8>
pub fn get_crc_vec_be(&mut self) -> Vec<u8>
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.
source§impl CRCu16
impl CRCu16
sourcepub fn crc10() -> CRCu16
pub fn crc10() -> CRCu16
Check | Poly | Init | Ref | XorOut |
---|---|---|---|---|
0x199 | 0x233 | 0x000 | false | 0x000 |
let mut crc = CRCu16::crc10();
crc.digest(b"123456789");
assert_eq!("0x199", &crc.to_string());
sourcepub fn crc10cdma2000() -> CRCu16
pub fn crc10cdma2000() -> CRCu16
Check | Poly | Init | Ref | XorOut |
---|---|---|---|---|
0x233 | 0x3D9 | 0x3FF | false | 0x000 |
let mut crc = CRCu16::crc10cdma2000();
crc.digest(b"123456789");
assert_eq!("0x233", &crc.to_string());
sourcepub fn crc10gsm() -> CRCu16
pub fn crc10gsm() -> CRCu16
Check | Poly | Init | Ref | XorOut |
---|---|---|---|---|
0x12A | 0x175 | 0x000 | false | 0x3FF |
let mut crc = CRCu16::crc10gsm();
crc.digest(b"123456789");
assert_eq!("0x12A", &crc.to_string());
sourcepub fn crc11() -> CRCu16
pub fn crc11() -> CRCu16
Check | Poly | Init | Ref | XorOut |
---|---|---|---|---|
0x5A3 | 0x385 | 0x01a | false | 0x000 |
let mut crc = CRCu16::crc11();
crc.digest(b"123456789");
assert_eq!("0x5A3", &crc.to_string());
sourcepub fn crc12() -> CRCu16
pub fn crc12() -> CRCu16
Check | Poly | Init | Ref | XorOut |
---|---|---|---|---|
0xF5B | 0x80F | 0x000 | false | 0x000 |
let mut crc = CRCu16::crc12();
crc.digest(b"123456789");
assert_eq!("0xF5B", &crc.to_string());
sourcepub fn crc12cdma2000() -> CRCu16
pub fn crc12cdma2000() -> CRCu16
Check | Poly | Init | Ref | XorOut |
---|---|---|---|---|
0xD4D | 0xF13 | 0xFFF | false | 0x000 |
let mut crc = CRCu16::crc12cdma2000();
crc.digest(b"123456789");
assert_eq!("0xD4D", &crc.to_string());
sourcepub fn crc12gsm() -> CRCu16
pub fn crc12gsm() -> CRCu16
Check | Poly | Init | Ref | XorOut |
---|---|---|---|---|
0xB34 | 0xD31 | 0x000 | false | 0xFFF |
let mut crc = CRCu16::crc12gsm();
crc.digest(b"123456789");
assert_eq!("0xB34", &crc.to_string());
sourcepub fn crc13bbc() -> CRCu16
pub fn crc13bbc() -> CRCu16
Check | Poly | Init | Ref | XorOut |
---|---|---|---|---|
0x04FA | 0x1CF5 | 0x0000 | false | 0x0000 |
let mut crc = CRCu16::crc13bbc();
crc.digest(b"123456789");
assert_eq!("0x04FA", &crc.to_string());
sourcepub fn crc14darc() -> CRCu16
pub fn crc14darc() -> CRCu16
Check | Poly | Init | Ref | XorOut |
---|---|---|---|---|
0x082D | 0x0805 (rev: 0x2804) | 0x0000 | true | 0x0000 |
let mut crc = CRCu16::crc14darc();
crc.digest(b"123456789");
assert_eq!("0x082D", &crc.to_string());
sourcepub fn crc14gsm() -> CRCu16
pub fn crc14gsm() -> CRCu16
Check | Poly | Init | Ref | XorOut |
---|---|---|---|---|
0x30AE | 0x202D | 0x0000 | false | 0x3FFF |
let mut crc = CRCu16::crc14gsm();
crc.digest(b"123456789");
assert_eq!("0x30AE", &crc.to_string());
sourcepub fn crc15can() -> CRCu16
pub fn crc15can() -> CRCu16
Check | Poly | Init | Ref | XorOut |
---|---|---|---|---|
0x059E | 0x4599 | 0x0000 | false | 0x0000 |
let mut crc = CRCu16::crc15can();
crc.digest(b"123456789");
assert_eq!("0x059E", &crc.to_string());
sourcepub fn crc15mpt1327() -> CRCu16
pub fn crc15mpt1327() -> CRCu16
Check | Poly | Init | Ref | XorOut |
---|---|---|---|---|
0x2566 | 0x6815 | 0x0000 | false | 0x0001 |
let mut crc = CRCu16::crc15mpt1327();
crc.digest(b"123456789");
assert_eq!("0x2566", &crc.to_string());
sourcepub fn crc16() -> CRCu16
pub fn crc16() -> CRCu16
Check | Poly | Init | Ref | XorOut |
---|---|---|---|---|
0xBB3D | 0x8005 (rev: 0xA001) | 0x0000 | true | 0x0000 |
let mut crc = CRCu16::crc16();
crc.digest(b"123456789");
assert_eq!("0xBB3D", &crc.to_string());
sourcepub fn crc16ccitt_false() -> CRCu16
pub fn crc16ccitt_false() -> CRCu16
Check | Poly | Init | Ref | XorOut |
---|---|---|---|---|
0x29B1 | 0x1021 | 0xFFFF | false | 0x0000 |
let mut crc = CRCu16::crc16ccitt_false();
crc.digest(b"123456789");
assert_eq!("0x29B1", &crc.to_string());
sourcepub fn crc16aug_ccitt() -> CRCu16
pub fn crc16aug_ccitt() -> CRCu16
Check | Poly | Init | Ref | XorOut |
---|---|---|---|---|
0xE5CC | 0x1021 | 0x1D0F | false | 0x0000 |
let mut crc = CRCu16::crc16aug_ccitt();
crc.digest(b"123456789");
assert_eq!("0xE5CC", &crc.to_string());
sourcepub fn crc16buypass() -> CRCu16
pub fn crc16buypass() -> CRCu16
Check | Poly | Init | Ref | XorOut |
---|---|---|---|---|
0xFEE8 | 0x8005 | 0x0000 | false | 0x0000 |
let mut crc = CRCu16::crc16buypass();
crc.digest(b"123456789");
assert_eq!("0xFEE8", &crc.to_string());
sourcepub fn crc16cdma2000() -> CRCu16
pub fn crc16cdma2000() -> CRCu16
Check | Poly | Init | Ref | XorOut |
---|---|---|---|---|
0x4C06 | 0xC867 | 0xFFFF | false | 0x0000 |
let mut crc = CRCu16::crc16cdma2000();
crc.digest(b"123456789");
assert_eq!("0x4C06", &crc.to_string());
sourcepub fn crc16dds_110() -> CRCu16
pub fn crc16dds_110() -> CRCu16
Check | Poly | Init | Ref | XorOut |
---|---|---|---|---|
0x9ECF | 0x8005 | 0x800D | false | 0x0000 |
let mut crc = CRCu16::crc16dds_110();
crc.digest(b"123456789");
assert_eq!("0x9ECF", &crc.to_string());
sourcepub fn crc16dect_r() -> CRCu16
pub fn crc16dect_r() -> CRCu16
Check | Poly | Init | Ref | XorOut |
---|---|---|---|---|
0x007E | 0x0589 | 0x0000 | false | 0x0001 |
let mut crc = CRCu16::crc16dect_r();
crc.digest(b"123456789");
assert_eq!("0x007E", &crc.to_string());
sourcepub fn crc16dect_x() -> CRCu16
pub fn crc16dect_x() -> CRCu16
Check | Poly | Init | Ref | XorOut |
---|---|---|---|---|
0x007F | 0x0589 | 0x0000 | false | 0x0000 |
let mut crc = CRCu16::crc16dect_r();
crc.digest(b"123456789");
assert_eq!("0x007E", &crc.to_string());
sourcepub fn crc16dnp() -> CRCu16
pub fn crc16dnp() -> CRCu16
Check | Poly | Init | Ref | XorOut |
---|---|---|---|---|
0xEA82 | 0x3D65 (rev: 0xA6BC) | 0x0000 | true | 0xFFFF |
let mut crc = CRCu16::crc16dnp();
crc.digest(b"123456789");
assert_eq!("0xEA82", &crc.to_string());
sourcepub fn crc16en_13757() -> CRCu16
pub fn crc16en_13757() -> CRCu16
Check | Poly | Init | Ref | XorOut |
---|---|---|---|---|
0xC2B7 | 0x3D65 | 0x0000 | false | 0xFFFF |
let mut crc = CRCu16::crc16en_13757();
crc.digest(b"123456789");
assert_eq!("0xC2B7", &crc.to_string());
sourcepub fn crc16genibus() -> CRCu16
pub fn crc16genibus() -> CRCu16
Check | Poly | Init | Ref | XorOut |
---|---|---|---|---|
0xD64E | 0x1021 | 0xFFFF | false | 0xFFFF |
let mut crc = CRCu16::crc16genibus();
crc.digest(b"123456789");
assert_eq!("0xD64E", &crc.to_string());
sourcepub fn crc16maxim() -> CRCu16
pub fn crc16maxim() -> CRCu16
Check | Poly | Init | Ref | XorOut |
---|---|---|---|---|
0x44C2 | 0x8005 (rev: 0xA001) | 0xFFFF | true | 0xFFFF |
let mut crc = CRCu16::crc16maxim();
crc.digest(b"123456789");
assert_eq!("0x44C2", &crc.to_string());
sourcepub fn crc16mcrf4cc() -> CRCu16
pub fn crc16mcrf4cc() -> CRCu16
Check | Poly | Init | Ref | XorOut |
---|---|---|---|---|
0x6F91 | 0x1021 (rev: 0x8408) | 0xFFFF | true | 0x0000 |
let mut crc = CRCu16::crc16mcrf4cc();
crc.digest(b"123456789");
assert_eq!("0x6F91", &crc.to_string());
sourcepub fn crc16riello() -> CRCu16
pub fn crc16riello() -> CRCu16
Check | Poly | Init | Ref | XorOut |
---|---|---|---|---|
0x63D0 | 0x1021 (rev: 0x8408) | 0xB2AA | true | 0x0000 |
let mut crc = CRCu16::crc16riello();
crc.digest(b"123456789");
assert_eq!("0x63D0", &crc.to_string());
sourcepub fn crc16t10_dif() -> CRCu16
pub fn crc16t10_dif() -> CRCu16
Check | Poly | Init | Ref | XorOut |
---|---|---|---|---|
0xD0DB | 0x8BB7 | 0x0000 | false | 0x0000 |
let mut crc = CRCu16::crc16t10_dif();
crc.digest(b"123456789");
assert_eq!("0xD0DB", &crc.to_string());
sourcepub fn crc16teledisk() -> CRCu16
pub fn crc16teledisk() -> CRCu16
Check | Poly | Init | Ref | XorOut |
---|---|---|---|---|
0x0FB3 | 0xA097 | 0x0000 | false | 0x0000 |
let mut crc = CRCu16::crc16teledisk();
crc.digest(b"123456789");
assert_eq!("0x0FB3", &crc.to_string());
sourcepub fn crc16tms13157() -> CRCu16
pub fn crc16tms13157() -> CRCu16
Check | Poly | Init | Ref | XorOut |
---|---|---|---|---|
0x26B1 | 0x1021 (rev: 0x8408) | 0x89EC | true | 0x0000 |
let mut crc = CRCu16::crc16tms13157();
crc.digest(b"123456789");
assert_eq!("0x26B1", &crc.to_string());
sourcepub fn crc16usb() -> CRCu16
pub fn crc16usb() -> CRCu16
Check | Poly | Init | Ref | XorOut |
---|---|---|---|---|
0xB4C8 | 0x8005 (rev: 0xA001) | 0xFFFF | true | 0xFFFF |
let mut crc = CRCu16::crc16usb();
crc.digest(b"123456789");
assert_eq!("0xB4C8", &crc.to_string());
sourcepub fn crc_a() -> CRCu16
pub fn crc_a() -> CRCu16
Check | Poly | Init | Ref | XorOut |
---|---|---|---|---|
0xBF05 | 0x1021 (rev: 0x8408) | 0xC6C6 | true | 0x0000 |
let mut crc = CRCu16::crc_a();
crc.digest(b"123456789");
assert_eq!("0xBF05", &crc.to_string());
sourcepub fn crc16kermit() -> CRCu16
pub fn crc16kermit() -> CRCu16
Check | Poly | Init | Ref | XorOut |
---|---|---|---|---|
0x2189 | 0x1021 (rev: 0x8408) | 0x0000 | true | 0x0000 |
let mut crc = CRCu16::crc16kermit();
crc.digest(b"123456789");
assert_eq!("0x2189", &crc.to_string());
sourcepub fn crc16modbus() -> CRCu16
pub fn crc16modbus() -> CRCu16
Check | Poly | Init | Ref | XorOut |
---|---|---|---|---|
0x4B37 | 0x8005 (rev: 0xA001) | 0xFFFF | true | 0x0000 |
let mut crc = CRCu16::crc16modbus();
crc.digest(b"123456789");
assert_eq!("0x4B37", &crc.to_string());
sourcepub fn crc16_x25() -> CRCu16
pub fn crc16_x25() -> CRCu16
Check | Poly | Init | Ref | XorOut |
---|---|---|---|---|
0x906E | 0x8005 (rev: 0xA001) | 0xFFFF | true | 0xFFFF |
let mut crc = CRCu16::crc16_x25();
crc.digest(b"123456789");
assert_eq!("0x906E", &crc.to_string());
sourcepub fn crc16xmodem() -> CRCu16
pub fn crc16xmodem() -> CRCu16
Check | Poly | Init | Ref | XorOut |
---|---|---|---|---|
0x31C3 | 0x1021 | 0x0000 | false | 0x0000 |
let mut crc = CRCu16::crc16xmodem();
crc.digest(b"123456789");
assert_eq!("0x31C3", &crc.to_string());
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CRCu16
impl RefUnwindSafe for CRCu16
impl Send for CRCu16
impl Sync for CRCu16
impl Unpin for CRCu16
impl UnwindSafe for CRCu16
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more