Packages / rupm

sha2-tools 0.1.0

SHA-224, SHA-256, SHA-384 and SHA-512 hashes with a streaming API, std only

Install

cargo add sha2-tools --registry rupm

In Ruststudio: Packages, search for sha2-tools, Install.

Owner: Rust Studio. Licence: MIT OR Apache-2.0. Total downloads: 0. Published 2026-11-22.

Versions

README

# sha2-tools

SHA-224, SHA-256, SHA-384 and SHA-512 hashes with a streaming API, std only

Add it with `rupm add sha2-tools` (or `cargo add sha2-tools --registry rupm`).

The hashes are checked against the NIST test vectors. This is a plain, unaudited implementation that is not constant-time: do not use it for security-critical work, use an audited crate there.

```rust
let hex = sha2_tools::sha256_hex(b"abc");
assert_eq!(hex, "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad");
let mut h = sha2_tools::Hasher::new(sha2_tools::Sha2::Sha512);
h.update(b"a");
h.update(b"bc");
assert_eq!(h.finalize().len(), 64);
```