Crates.io | chksum |
lib.rs | chksum |
version | 0.3.0 |
source | src |
created_at | 2020-05-23 18:38:02.797622 |
updated_at | 2023-12-21 17:39:45.501165 |
description | An implementation of hash functions with a straightforward interface for computing digests of bytes, files, directories, and more. |
homepage | |
repository | https://github.com/chksum-rs/lib |
max_upload_size | |
id | 244950 |
size | 36,369 |
An implementation of various hash functions with a straightforward interface for computing digests of bytes, files, directories, and more.
To use this crate, add the following entry to your Cargo.toml
file in the dependencies
section:
[dependencies]
chksum = "0.3.0"
Alternatively, you can use the cargo add
subcommand:
cargo add chksum
Use the chksum
function to calcualate digest of file, directory and so on.
use chksum::sha2_256;
let file = File::open(path)?;
let digest = sha2_256::chksum(file)?;
assert_eq!(
digest.to_hex_lowercase(),
"44752f37272e944fd2c913a35342eaccdd1aaf189bae50676b301ab213fc5061"
);
For more usage examples, refer to the documentation available at docs.rs.
This crate provides implementations for the following hash algorithms:
This crate is licensed under the MIT License.