chksum

GitHub docs.rs Coverage MSRV deps.rs unsafe forbidden LICENSE

High-level interface for easy calculation of checksum digest for files, directories, stdin and more.

Features

Setup

Add the following entry to the dependencies section of your Cargo.toml file:

```toml [dependencies]

...

chksum = "0.2.1" ```

Alternatively, you can use the cargo add subcommand:

shell cargo add chksum

Usage

Use chksum function and File as an input.

```rust use std::fs::File;

use chksum::chksum; use chksum::hash::SHA2_224;

let file = File::open(path)?; let digest = chksum::(file)?; asserteq!( digest.tohex_lowercase(), "a39b86d838273f5ff4879c26f85e3cb333bb44d73b24f275bad1a6c6" ); ```

Alternatively use ReadDir as an input.

```rust use std::fs::read_dir;

use chksum::chksum; use chksum::hash::SHA2_256;

let dir = readdir(path)?; let digest = chksum::(dir)?; asserteq!( digest.tohexlowercase(), "5c3bfbc8614adc72d3ec0e9b15a1fd1c55cee63e34af5a4ff058eb2eef7d8482" ); ```

For more usage examples, refer to the documentation available at docs.rs.

Low-level interface

Check chksum-hash for low-level interface.

License

MIT