#sha-1 #hash #digest #checksum #hashing

chksum-hash-sha1

An implementation of SHA-1 hash algorithm for batch and stream computation

2 releases

0.0.1 Apr 28, 2024
0.0.0 Dec 21, 2023

#19 in #sha1

Download history 2241/week @ 2024-02-08 1764/week @ 2024-02-15 2512/week @ 2024-02-22 2121/week @ 2024-02-29 2268/week @ 2024-03-07 2456/week @ 2024-03-14 2575/week @ 2024-03-21 460/week @ 2024-03-28 580/week @ 2024-04-04 688/week @ 2024-04-11 391/week @ 2024-04-18 497/week @ 2024-04-25 458/week @ 2024-05-02 459/week @ 2024-05-09 436/week @ 2024-05-16 504/week @ 2024-05-23

1,916 downloads per month
Used in 4 crates (2 directly)

MIT license

56KB
910 lines

chksum-hash-sha1

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

An implementation of SHA-1 hash algorithm for batch and stream computation.

Setup

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

Usage

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.

License

This crate is licensed under the MIT License.

Dependencies

~0.3–0.8MB
~20K SLoC