Struct crc_any::CRCu64

source ·
pub struct CRCu64 { /* private fields */ }
Expand description

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

Implementations§

source§

impl CRCu64

source

pub fn create_crc( poly: u64, bits: u8, initial: u64, final_xor: u64, reflect: bool ) -> CRCu64

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

source

pub fn digest<T: ?Sized + AsRef<[u8]>>(&mut self, data: &T)

Digest some data.

source

pub fn reset(&mut self)

Reset the sum.

source

pub fn get_crc(&self) -> u64

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

source§

impl CRCu64

source

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.

source

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 CRCu64

source

pub fn crc40gsm() -> CRCu64

CheckPolyInitRefXorOut
0xD4164FC6460x00048200090x0000000000false0xFFFFFFFFFF
let mut crc = CRCu64::crc40gsm();
crc.digest(b"123456789");
assert_eq!("0xD4164FC646", &crc.to_string());
source

pub fn crc64() -> CRCu64

CheckPolyInitRefXorOut
0x6C40DF5F0B4973470x42F0E1EBA9EA36930x0000000000000000false0x0000000000000000
let mut crc = CRCu64::crc64();
crc.digest(b"123456789");
assert_eq!("0x6C40DF5F0B497347", &crc.to_string());
source

pub fn crc64iso() -> CRCu64

CheckPolyInitRefXorOut
0xB90956C775A410010x000000000000001B (rev: 0xD800000000000000)0xFFFFFFFFFFFFFFFFtrue0xFFFFFFFFFFFFFFFF
let mut crc = CRCu64::crc64iso();
crc.digest(b"123456789");
assert_eq!("0xB90956C775A41001", &crc.to_string());
source

pub fn crc64we() -> CRCu64

CheckPolyInitRefXorOut
0x62EC59E3F1A4F00A0x42F0E1EBA9EA36930xFFFFFFFFFFFFFFFFfalse0xFFFFFFFFFFFFFFFF
let mut crc = CRCu64::crc64we();
crc.digest(b"123456789");
assert_eq!("0x62EC59E3F1A4F00A", &crc.to_string());
source

pub fn crc64jones() -> CRCu64

CheckPolyInitRefXorOut
0xE9C6D914C4B8D9CA0xAD93D23594C935A9 (rev: 0x95AC9329AC4BC9B5)0x0000000000000000true0x0000000000000000
let mut crc = CRCu64::crc64jones();
crc.digest(b"123456789");
assert_eq!("0xE9C6D914C4B8D9CA", &crc.to_string());

Trait Implementations§

source§

impl Debug for CRCu64

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Display for CRCu64

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for CRCu64

§

impl RefUnwindSafe for CRCu64

§

impl Send for CRCu64

§

impl Sync for CRCu64

§

impl Unpin for CRCu64

§

impl UnwindSafe for CRCu64

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.