| Crates.io | hmac-sha512 |
| lib.rs | hmac-sha512 |
| version | 1.1.7 |
| created_at | 2020-05-01 09:47:22.163746+00 |
| updated_at | 2025-05-19 07:54:32.210648+00 |
| description | A small, self-contained SHA512, HMAC-SHA512, SHA384 and HMAC-SHA384 implementation |
| homepage | https://github.com/jedisct1/rust-hmac-sha512 |
| repository | https://github.com/jedisct1/rust-hmac-sha512 |
| max_upload_size | |
| id | 236087 |
| size | 37,600 |
A small, self-contained implementation of SHA512, HMAC-SHA512, SHA384, and HMAC-SHA384 in Rust.
no_std compatible for embedded systemsDigest trait from the digest cratesha384 (enabled by default): Includes SHA384 and HMAC-SHA384 implementationsopt_size: Optimizes for binary size at a slight performance cost (reduces text section size by ~75% with ~16% performance hit)traits: Enables support for the Digest trait from the digest crate
traits09: Support for digest crate v0.9.xtraits010: Support for digest crate v0.10.xAdd this to your Cargo.toml:
[dependencies]
hmac-sha512 = "1.1.6"
use hmac_sha512::Hash;
// Compute SHA512 hash
let hash = Hash::hash(b"message");
use hmac_sha512::HMAC;
// Compute HMAC-SHA512
let mac = HMAC::mac(b"message", b"key");
// Verify HMAC-SHA512
let expected = [0u8; 64]; // Replace with actual expected MAC
let is_valid = HMAC::verify(b"message", b"key", &expected);
use hmac_sha512::sha384::Hash;
// Compute SHA384 hash
let hash = Hash::hash(b"message");
use hmac_sha512::sha384::HMAC;
// Compute HMAC-SHA384
let mac = HMAC::mac(b"message", b"key");
// Verify HMAC-SHA384
let expected = [0u8; 48]; // Replace with actual expected MAC
let is_valid = HMAC::verify(b"message", b"key", &expected);
use hmac_sha512::Hash;
use digest::Digest; // Requires the digest crate
let mut hasher = Hash::new();
hasher.update(b"message");
let result = hasher.finalize();
# Build with default features
cargo build
# Build with release optimizations
cargo build --release
# Build with specific features
cargo build --features="traits"
cargo build --features="opt_size"
cargo build --no-default-features # Excludes SHA384 support
# Run all tests
cargo test
This project is licensed under the ISC License.