pub struct Digest { /* private fields */ }
Expand description

Digest struct for CRC calculation

  • table: Calculation table generated from input parameters.
  • initial: Initial value.
  • value: Current value of the CRC calculation.
  • final_xor: Final value to XOR with when calling Digest::sum32().
  • calc: Type of calculation. See its documentation for details.

Implementations

Creates a new Digest from input polynomial.

Example
use crc::{crc32, Hasher32};
let mut digest = crc32::Digest::new(crc32::IEEE);
digest.write(b"123456789");
assert_eq!(digest.sum32(), 0xcbf43926);;

Creates a new Digest from input polynomial and initial value.

Example
use crc::{crc32, Hasher32};
let mut digest = crc32::Digest::new_with_initial(crc32::IEEE, 0u32);
digest.write(b"123456789");
assert_eq!(digest.sum32(), 0xcbf43926);

Creates a fully customized Digest from input parameters.

Example
use crc::{crc32, Hasher32};
let mut digest = crc32::Digest::new_custom(crc32::IEEE, !0u32, !0u32, crc::CalcType::Reverse);
digest.write(b"123456789");
assert_eq!(digest.sum32(), 0xcbf43926);

Trait Implementations

Returns the hash value for the values written so far. Read more
Writes some data into this Hasher. Read more
Writes a single u8 into this hasher.
Writes a single u16 into this hasher.
Writes a single u32 into this hasher.
Writes a single u64 into this hasher.
Writes a single u128 into this hasher.
Writes a single usize into this hasher.
Writes a single i8 into this hasher.
Writes a single i16 into this hasher.
Writes a single i32 into this hasher.
Writes a single i64 into this hasher.
Writes a single i128 into this hasher.
Writes a single isize into this hasher.
🔬This is a nightly-only experimental API. (hasher_prefixfree_extras)
Writes a length prefix into this hasher, as part of being prefix-free. Read more
🔬This is a nightly-only experimental API. (hasher_prefixfree_extras)
Writes a single str into this hasher. Read more
Resets CRC calculation to initial value
Updates CRC calculation with input byte array bytes
Returns checksum after being XOR’d with final_xor

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

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.