SHA-512
Algorithm
SHA-512 (FIPS 180-4) uses a 1024-bit block and produces a 512-bit digest. SHA-384 is the same core with a truncated output (first 384 bits); it is common in TLS cipher suites and certificates that specify SHA-384.
Purpose
SHA-512 and SHA-384 (SHA-512/256) for long-output digests and SHA-384 TLS profiles.
Rust API
- Crate:
noxtls-crypto - Module path (conceptual):
noxtls_crypto::hash - Primary symbols:
noxtls_sha512noxtls_sha384Sha512Digest
Functions and types:
noxtls_sha512(data) -> [u8; 64]/noxtls_sha384(data) -> [u8; 48]- Parameters:datais the full input byte slice. Behavior: computes one-shot SHA-512 or SHA-384 digests. Returns: fixed-size digest arrays (64or48bytes).Sha512- Parameters: feed data through repeatedupdate(&[u8])calls, then callfinalize(). Behavior: provides incremental hashing for large/chunked messages. Returns:finalize()emits digest bytes asVec<u8>.
Feature flags and policy
Default.
Examples
use noxtls_crypto::{noxtls_sha512, noxtls_sha384, Digest, Sha512};
let d512 = noxtls_sha512(b"message");
assert_eq!(d512.len(), 64);
let d384 = noxtls_sha384(b"message");
assert_eq!(d384.len(), 48);
let mut h = Sha512::new();
h.update(b"stream");
let out = h.finalize();
Security and compatibility
Prefer SHA-256 unless you need SHA-384-sized outputs or protocol-required SHA-512.