1 unstable release

Uses old Rust 2015

0.1.1 Apr 21, 2016
0.1.0 Apr 21, 2016

#83 in #crc

Download history 436/week @ 2024-09-13 677/week @ 2024-09-20 848/week @ 2024-09-27 834/week @ 2024-10-04 925/week @ 2024-10-11 1063/week @ 2024-10-18 1258/week @ 2024-10-25 1198/week @ 2024-11-01 1075/week @ 2024-11-08 1111/week @ 2024-11-15 1066/week @ 2024-11-22 777/week @ 2024-11-29 1058/week @ 2024-12-06 1307/week @ 2024-12-13 478/week @ 2024-12-20 309/week @ 2024-12-27

3,226 downloads per month
Used in 22 crates (4 directly)

MIT license

4KB
52 lines

rust-crc8

A CRC8 implementation

Usage

extern crate crc8;
use crc8::*;

fn main() {
        let buff : [u8; 3] = [1, 2, 3];

        /* Init Crc8 module for given polynomial in regular bit order. */
        let mut crc8 = Crc8::create_lsb(130);

        /* calculate a crc8 over the given input data.
         * pbuffer: pointer to data buffer.
         * length: number of bytes in data buffer.
         * crc:	previous returned crc8 value.
        */
        let mut crc = crc8.calc(&buff, 3, 0);
        println!("crc8: {}", crc);

        /* Init Crc8 module for given polynomial in reverse bit order. */
        crc8 = Crc8::create_msb(130);
        crc = crc8.calc(&buff, 3, 0);
        println!("crc8: {}", crc);
}

No runtime deps