https://github.com/mkopa/rust-crc8
A CRC8 implementation
https://github.com/mkopa/rust-crc8
Last synced: 3 months ago
JSON representation
A CRC8 implementation
- Host: GitHub
- URL: https://github.com/mkopa/rust-crc8
- Owner: mkopa
- License: mit
- Created: 2016-04-21T12:40:11.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-10-01T15:06:50.000Z (almost 10 years ago)
- Last Synced: 2025-12-14T03:19:36.739Z (7 months ago)
- Language: Rust
- Size: 3.91 KB
- Stars: 3
- Watchers: 1
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rust-crc8
A CRC8 implementation
#### Installation
Use [cargo package](https://crates.io/crates/crc8).
#### Usage
```rust
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);
}
```