| Crates.io | chksum-hash-sha1 |
| lib.rs | chksum-hash-sha1 |
| version | 0.0.1 |
| created_at | 2023-12-21 15:28:03.713487+00 |
| updated_at | 2024-04-28 19:17:19.527456+00 |
| description | An implementation of SHA-1 hash algorithm for batch and stream computation. |
| homepage | |
| repository | https://github.com/chksum-rs/hash-sha-1 |
| max_upload_size | |
| id | 1077061 |
| size | 69,233 |
An implementation of SHA-1 hash algorithm for batch and stream computation.
To use this crate, add the following entry to your Cargo.toml file in the dependencies section:
[dependencies]
chksum-hash-sha1 = "0.0.1"
Alternatively, you can use the cargo add subcommand:
cargo add chksum-hash-sha1
Use the hash function for batch digest calculation.
use chksum_hash_sha1 as sha1;
let digest = sha1::hash(b"example data");
assert_eq!(
digest.to_hex_lowercase(),
"efaa311ae448a7374c122061bfed952d940e9e37"
);
Use the default function to create a hash instance for stream digest calculation.
use chksum_hash_sha1 as sha1;
let digest = sha1::default()
.update("example")
.update(b"data")
.update([0, 1, 2, 3])
.digest();
assert_eq!(
digest.to_hex_lowercase(),
"041fa30bf932ae251b33ef8c554be33bb819e380"
);
For more usage examples, refer to the documentation available at docs.rs.
This crate is licensed under the MIT License.