chksum-hash

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

A simple cryptography library that provides an interface for calculating hash digests using both batch and stream computation.

Features

Setup

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

```toml [dependencies]

...

chksum-hash = "0.4.2" ```

Alternatively, you can use the cargo add subcommand:

shell cargo add chksum-hash

Usage

Use hash function for batch digest calculation.

```rust use chksumhash::{hash, SHA2224};

let digest = hash::(b"somedata"); asserteq!( digest.tohex_lowercase(), "a39b86d838273f5ff4879c26f85e3cb333bb44d73b24f275bad1a6c6" ); ```

Use default function to create hash instance for stream digest calculation.

```rust use chksumhash::{default, SHA2256};

let digest = default::() .update("some") .update(b"data") .update([0, 1, 2, 3]) .digest(); asserteq!( digest.tohex_lowercase(), "5c3bfbc8614adc72d3ec0e9b15a1fd1c55cee63e34af5a4ff058eb2eef7d8482" ); ```

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

License

MIT