Debian Codegraph @

/

debian rust-hmac-sha256 1.1.14-1debian librust-hmac-sha256-dev debian librust-hmac-sha256+default-dev debian librust-hmac-sha256+digest010-dev debian librust-hmac-sha256+digest011-dev debian librust-hmac-sha256+opt-size-dev debian librust-hmac-sha256+traits-dev debian librust-hmac-sha256+traits010-dev debian librust-hmac-sha256+traits011-dev debian librust-hmac-sha256-1-dev debian librust-hmac-sha256-1+default-dev debian librust-hmac-sha256-1+digest010-dev debian librust-hmac-sha256-1+digest011-dev debian librust-hmac-sha256-1+opt-size-dev debian librust-hmac-sha256-1+traits-dev debian librust-hmac-sha256-1+traits010-dev debian librust-hmac-sha256-1+traits011-dev debian librust-hmac-sha256-1.1-dev debian librust-hmac-sha256-1.1+default-dev debian librust-hmac-sha256-1.1+digest010-dev
14 more… debian librust-hmac-sha256-1.1+digest011-dev debian librust-hmac-sha256-1.1+opt-size-dev debian librust-hmac-sha256-1.1+traits-dev debian librust-hmac-sha256-1.1+traits010-dev debian librust-hmac-sha256-1.1+traits011-dev debian librust-hmac-sha256-1.1.14-dev debian librust-hmac-sha256-1.1.14+default-dev debian librust-hmac-sha256-1.1.14+digest010-dev debian librust-hmac-sha256-1.1.14+digest011-dev debian librust-hmac-sha256-1.1.14+opt-size-dev debian librust-hmac-sha256-1.1.14+traits-dev debian librust-hmac-sha256-1.1.14+traits010-dev debian librust-hmac-sha256-1.1.14+traits011-dev cargo hmac-sha256 1.1.14
debianjsonmakefilemarkdownrustrust-c-abishelltomlyaml 20 files · 344 symbols
View dependency graph

Depends on

  • dh-cargo (dh-sequence-cargo)
  • rust-digest (librust-digest-0.11+default-dev, librust-digest-0.11+oid-dev)
  • rust-digest-0.10 (librust-digest-0.10+default-dev, librust-digest-0.10+oid-dev)
  • cargo, debhelper-compat, libstd-rust-dev, rustc
README (full)

rust-hmac-sha256

A small, self-contained SHA256, HMAC-SHA256, and HKDF-SHA256 implementation in Rust with no_std support.

Features

  • Pure Rust implementation
  • No external dependencies (unless optional features are enabled)
  • no_std compatible
  • Both one-shot and streaming APIs
  • Constant-time verification to prevent timing attacks
  • HKDF key derivation (extraction and expansion)

Optional Features

  • traits: Enable support for the Digest trait from the digest crate (both version 0.9.0 and 0.10.7)
  • opt_size: Enable size optimizations. Based on benchmarks, the .text section size is reduced by 75%, at the cost of approximately 16% performance.

Usage Examples

SHA-256

// One-shot hashing
let hash = hmac_sha256::Hash::hash(b"hello world");

// Incremental hashing
let mut hasher = hmac_sha256::Hash::new();
hasher.update(b"hello ");
hasher.update(b"world");
let hash = hasher.finalize();

// Constant-time verification
let expected = hmac_sha256::Hash::hash(b"hello world");
let mut hasher = hmac_sha256::Hash::new();
hasher.update(b"hello world");
assert!(hasher.verify(&expected));

HMAC-SHA256

// One-shot HMAC
let mac = hmac_sha256::HMAC::mac(b"message", b"key");

// Incremental HMAC
let mut hmac = hmac_sha256::HMAC::new(b"key");
hmac.update(b"message part 1");
hmac.update(b"message part 2");
let mac = hmac.finalize();

// Constant-time verification
let expected = hmac_sha256::HMAC::mac(b"message", b"key");
let mut hmac = hmac_sha256::HMAC::new(b"key");
hmac.update(b"message");
assert!(hmac.verify(&expected));

HKDF-SHA256

// Extract a pseudorandom key from input keying material
let prk = hmac_sha256::HKDF::extract(b"salt", b"input key material");

// Expand the pseudorandom key to the desired output length
let mut output = [0u8; 64];
hmac_sha256::HKDF::expand(&mut output, prk, b"application info");
dir .github/
dir debian/
dir src/
dir tests/
file .cargo_vcs_info.json
file .gitignore
file Cargo.lock
file Cargo.toml
file Cargo.toml.orig
file LICENSE
file README.md