pub struct HKDF;Expand description
HMAC-based Key Derivation Function (HKDF) implementation using SHA-512.
HKDF is a key derivation function based on HMAC, standardized in RFC 5869. It derives cryptographically strong keys from input keying material.
The HKDF process consists of two stages:
- Extract: Takes input keying material and an optional salt, produces a pseudorandom key (PRK)
- Expand: Takes the PRK and optional context info, generates output keying material
§Examples
let prk = hmac_sha512::HKDF::extract(b"salt value", b"input key material");
let mut okm = [0u8; 128];
hmac_sha512::HKDF::expand(&mut okm, prk, b"application info");Implementations§
Source§impl HKDF
impl HKDF
Sourcepub fn expand(out: &mut [u8], prk: impl AsRef<[u8]>, info: impl AsRef<[u8]>)
pub fn expand(out: &mut [u8], prk: impl AsRef<[u8]>, info: impl AsRef<[u8]>)
Performs the HKDF-Expand function.
Expands the pseudorandom key into output keying material of the desired length.
§Arguments
out- Buffer to receive the output keying materialprk- Pseudorandom key (from the extract step)info- Optional context and application specific information
§Panics
Panics if the requested output length is greater than 255 * 64 bytes (16320 bytes).
Auto Trait Implementations§
impl Freeze for HKDF
impl RefUnwindSafe for HKDF
impl Send for HKDF
impl Sync for HKDF
impl Unpin for HKDF
impl UnwindSafe for HKDF
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more