Packages / rupm

rs-hash-sha2 0.1.0

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

Install

cargo add rs-hash-sha2 --registry rupm

In Ruststudio: Packages, search for rs-hash-sha2, Install.

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

Versions

README

# rs-hash-sha2

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

Add it with `rupm add rs-hash-sha2` (or `cargo add rs-hash-sha2 --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 = rs_hash_sha2::sha256_hex(b"abc");
assert_eq!(hex, "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad");
let mut h = rs_hash_sha2::Hasher::new(rs_hash_sha2::Sha2::Sha512);
h.update(b"a");
h.update(b"bc");
assert_eq!(h.finalize().len(), 64);
```