sonnenbrille

Crates.iosonnenbrille
lib.rssonnenbrille
version0.1.2
sourcesrc
created_at2021-10-21 02:09:43.779458
updated_at2023-12-13 15:23:39.13993
descriptionAn implementation of 8-bit CRC.
homepagehttps://github.com/solidsnack/sonnenbrille
repositoryhttps://github.com/solidsnack/sonnenbrille
max_upload_size
id468232
size10,653
Jason Dusek (solidsnack)

documentation

https://github.com/solidsnack/sonnenbrille#readme

README

Sonnenbrille

"Son­nen­bril­le, die -- Brille mit dunkel getönten Gläsern, die die Augen vor zu starker Helligkeit des Sonnenlichts schützen soll" -- Duden

"Sunglasses, feminine -- Glasses with dark-toned lenses, that protect the eyes from bright sunlight"

There are many articles, references and online resources for the Cyclic Redundancy Check, but I was surprised and greatly helped by the clarity and comprehensiveness of Sunshine 2K's Understanding and implementing CRC (Cyclic Redundancy Check) calculation. Along with the author's online implementation, this illuminating article made it possible for me to understand, implement and test an 8-bit CRC calculator in Rust.

extern crate sonnenbrille;
use sonnenbrille::CRC8;

fn crc8(num: u32): u8 {
    let calculator = CRC8::default();
    return calculator.of(&num.to_be_bytes(), 0x00);
}

fn main() {
    let num: u32 = 0x31313233;
    let calculator = CRC8::default();
    let checksum = calculator.of(&num.to_be_bytes(), 0x00);
    assert_eq!(checksum, 0x7F);
}
Commit count: 10

cargo fmt