crc8

Crates.iocrc8
lib.rscrc8
version0.1.1
sourcesrc
created_at2016-04-21 14:07:37.115702
updated_at2016-04-21 14:12:45.111345
descriptionA CRC8 implementation
homepage
repositoryhttps://github.com/mkopa/rust-crc8
max_upload_size
id4811
size4,250
Marcin Kopa (mkopa)

documentation

README

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);
}
Commit count: 10

cargo fmt