Struct crc_any::CRCu32[][src]

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

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

Implementations

Create a CRCu32 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 u32 value). You can continue calling digest method even after getting a CRC value.

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.

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.

CheckPolyInitRefXorOut
0x04F030x1685B0x00000false0x00000
let mut crc = CRCu32::crc17can();
crc.digest(b"123456789");
assert_eq!("0x04F03", &crc.to_string());
CheckPolyInitRefXorOut
0x0ED8410x1028990x000000false0x000000
let mut crc = CRCu32::crc21can();
crc.digest(b"123456789");
assert_eq!("0x0ED841", &crc.to_string());
CheckPolyInitRefXorOut
0x21CF020x864CFB0xB704CEfalse0x000000
let mut crc = CRCu32::crc24();
crc.digest(b"123456789");
assert_eq!("0x21CF02", &crc.to_string());
CheckPolyInitRefXorOut
0xC25A560x00065B (rev: 0xDA6000)0x555555true0x000000
let mut crc = CRCu32::crc24ble();
crc.digest(b"123456789");
assert_eq!("0xC25A56", &crc.to_string());
CheckPolyInitRefXorOut
0x7979BD0x5D6DCB0xFEDCBAfalse0x000000
let mut crc = CRCu32::crc24flexray_a();
crc.digest(b"123456789");
assert_eq!("0x7979BD", &crc.to_string());
CheckPolyInitRefXorOut
0x1F23B80x5D6DCB0xABCDEFfalse0x000000
let mut crc = CRCu32::crc24flexray_b();
crc.digest(b"123456789");
assert_eq!("0x1F23B8", &crc.to_string());
CheckPolyInitRefXorOut
0xCDE7030x864CFB0x000000false0x000000
let mut crc = CRCu32::crc24lte_a();
crc.digest(b"123456789");
assert_eq!("0xCDE703", &crc.to_string());
CheckPolyInitRefXorOut
0x23EF520x8000630x000000false0x000000
let mut crc = CRCu32::crc24lte_b();
crc.digest(b"123456789");
assert_eq!("0x23EF52", &crc.to_string());
CheckPolyInitRefXorOut
0x200FA50x8000630xFFFFFFfalse0xFFFFFF
let mut crc = CRCu32::crc24os9();
crc.digest(b"123456789");
assert_eq!("0x200FA5", &crc.to_string());
CheckPolyInitRefXorOut
0x04C34ABF0x2030B9C70x3FFFFFFFfalse0x3FFFFFFF
let mut crc = CRCu32::crc30cdma();
crc.digest(b"123456789");
assert_eq!("0x04C34ABF", &crc.to_string());
CheckPolyInitRefXorOut
0xCBF439260x04C11DB7 (rev: 0xEDB88320)0xFFFFFFFFtrue0xFFFFFFFF
let mut crc = CRCu32::crc32();
crc.digest(b"123456789");
assert_eq!("0xCBF43926", &crc.to_string());
CheckPolyInitRefXorOut
0x181989FC0x04C11DB70xFFFFFFFFfalse0xFFFFFFFF

Output will be reversed by bytes.

let mut crc = CRCu32::crc32mhash();
crc.digest(b"123456789");
assert_eq!("0x181989FC", &crc.to_string());
CheckPolyInitRefXorOut
0xFC8919180x04C11DB70xFFFFFFFFfalse0xFFFFFFFF
let mut crc = CRCu32::crc32bzip2();
crc.digest(b"123456789");
assert_eq!("0xFC891918", &crc.to_string());
CheckPolyInitRefXorOut
0xE30692830x1EDC6F41 (rev: 0x82F63B78)0xFFFFFFFFtrue0xFFFFFFFF
let mut crc = CRCu32::crc32c();
crc.digest(b"123456789");
assert_eq!("0xE3069283", &crc.to_string());
CheckPolyInitRefXorOut
0x873155760xA833982B (rev: 0xD419CC15)0xFFFFFFFFtrue0xFFFFFFFF
let mut crc = CRCu32::crc32d();
crc.digest(b"123456789");
assert_eq!("0x87315576", &crc.to_string());
CheckPolyInitRefXorOut
0x0376E6E70x04C11DB70xFFFFFFFFfalse0x00000000
let mut crc = CRCu32::crc32mpeg2();
crc.digest(b"123456789");
assert_eq!("0x0376E6E7", &crc.to_string());
CheckPolyInitRefXorOut
0x765E76800x04C11DB70x00000000false0xFFFFFFFF
let mut crc = CRCu32::crc32posix();
crc.digest(b"123456789");
assert_eq!("0x765E7680", &crc.to_string());
CheckPolyInitRefXorOut
0x3010BF7F0x814141AB0x00000000false0x00000000
let mut crc = CRCu32::crc32q();
crc.digest(b"123456789");
assert_eq!("0x3010BF7F", &crc.to_string());
CheckPolyInitRefXorOut
0x340BC6D90x04C11DB7 (rev: 0xEDB88320)0xFFFFFFFFtrue0x00000000
let mut crc = CRCu32::crc32jamcrc();
crc.digest(b"123456789");
assert_eq!("0x340BC6D9", &crc.to_string());
CheckPolyInitRefXorOut
0xBD0BE3380x000000AF0x00000000false0x00000000
let mut crc = CRCu32::crc32xfer();
crc.digest(b"123456789");
assert_eq!("0xBD0BE338", &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.