Struct crc_any::CRCu8[][src]

pub struct CRCu8 { /* fields omitted */ }
Expand description

This struct can help you compute a CRC-8 (or CRC-x where x is equal or less than 8) value.

Implementations

Create a CRCu8 instance by providing the length of bits, expression, reflection, an initial value and a final xor value.

Digest some data.

Reset the sum.

Get the current CRC value (it always returns a u8 value). You can continue calling digest method even after getting a CRC value.

CheckPolyInitRefXorOut
0x40x30x0false0x7
let mut crc = CRCu8::crc3gsm();
crc.digest(b"123456789");
assert_eq!("0x4", &crc.to_string());
CheckPolyInitRefXorOut
0x70x3 (rev: 0xC)0x0true0x0
let mut crc = CRCu8::crc4itu();
crc.digest(b"123456789");
assert_eq!("0x7", &crc.to_string());
CheckPolyInitRefXorOut
0xB0x30xFfalse0xF
let mut crc = CRCu8::crc4interlaken();
crc.digest(b"123456789");
assert_eq!("0xB", &crc.to_string());
CheckPolyInitRefXorOut
0x000x090x09false0x00
let mut crc = CRCu8::crc5epc();
crc.digest(b"123456789");
assert_eq!("0x00", &crc.to_string());
CheckPolyInitRefXorOut
0x070x15 (rev: 0x15)0x00true0x00
let mut crc = CRCu8::crc5itu();
crc.digest(b"123456789");
assert_eq!("0x07", &crc.to_string());
CheckPolyInitRefXorOut
0x190x05 (rev: 0x14)0x1Ftrue0x1F
let mut crc = CRCu8::crc5usb();
crc.digest(b"123456789");
assert_eq!("0x19", &crc.to_string());
CheckPolyInitRefXorOut
0x0D0x270x3Ffalse0x00
let mut crc = CRCu8::crc6cdma2000_a();
crc.digest(b"123456789");
assert_eq!("0x0D", &crc.to_string());
CheckPolyInitRefXorOut
0x3B0x070x3Ffalse0x00
let mut crc = CRCu8::crc6cdma2000_b();
crc.digest(b"123456789");
assert_eq!("0x3B", &crc.to_string());
CheckPolyInitRefXorOut
0x260x19 (rev: 0x26)0x00true0x00
let mut crc = CRCu8::crc6darc();
crc.digest(b"123456789");
assert_eq!("0x26", &crc.to_string());
CheckPolyInitRefXorOut
0x130x2F0x00false0x3F
let mut crc = CRCu8::crc6gsm();
crc.digest(b"123456789");
assert_eq!("0x13", &crc.to_string());
CheckPolyInitRefXorOut
0x060x03 (rev: 0x30)0x00true0x00
let mut crc = CRCu8::crc6itu();
crc.digest(b"123456789");
assert_eq!("0x06", &crc.to_string());
CheckPolyInitRefXorOut
0x750x090x00false0x00
let mut crc = CRCu8::crc7();
crc.digest(b"123456789");
assert_eq!("0x75", &crc.to_string());
CheckPolyInitRefXorOut
0x610x450x00false0x00
let mut crc = CRCu8::crc7umts();
crc.digest(b"123456789");
assert_eq!("0x61", &crc.to_string());
CheckPolyInitRefXorOut
0xF40x070x00false0x00
let mut crc = CRCu8::crc8();
crc.digest(b"123456789");
assert_eq!("0xF4", &crc.to_string());
CheckPolyInitRefXorOut
0xDA0x9B0xFFfalse0x00
let mut crc = CRCu8::crc8cdma2000();
crc.digest(b"123456789");
assert_eq!("0xDA", &crc.to_string());
CheckPolyInitRefXorOut
0x150x39 (rev: 0x9C)0x00true0x00
let mut crc = CRCu8::crc8darc();
crc.digest(b"123456789");
assert_eq!("0x15", &crc.to_string());
CheckPolyInitRefXorOut
0xBC0xD50x00false0x00
let mut crc = CRCu8::crc8dvb_s2();
crc.digest(b"123456789");
assert_eq!("0xBC", &crc.to_string());
CheckPolyInitRefXorOut
0x970x1D (rev: 0xB8)0xFFtrue0x00
let mut crc = CRCu8::crc8ebu();
crc.digest(b"123456789");
assert_eq!("0x97", &crc.to_string());
CheckPolyInitRefXorOut
0x7E0x1D0xFDfalse0x00
let mut crc = CRCu8::crc8icode();
crc.digest(b"123456789");
assert_eq!("0x7E", &crc.to_string());
CheckPolyInitRefXorOut
0xA10x070x00false0x55
let mut crc = CRCu8::crc8itu();
crc.digest(b"123456789");
assert_eq!("0xA1", &crc.to_string());
CheckPolyInitRefXorOut
0xA10x31 (rev: 0x8C)0x00true0x00
let mut crc = CRCu8::crc8maxim();
crc.digest(b"123456789");
assert_eq!("0xA1", &crc.to_string());
CheckPolyInitRefXorOut
0xD00x07 (rev: 0xE0)0xFFtrue0x00
let mut crc = CRCu8::crc8rohc();
crc.digest(b"123456789");
assert_eq!("0xD0", &crc.to_string());
CheckPolyInitRefXorOut
0x250x9B (rev: 0xD9)0x00true0x00
let mut crc = CRCu8::crc8wcdma();
crc.digest(b"123456789");
assert_eq!("0x25", &crc.to_string());

Trait Implementations

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.