Skip to main content

hkdf_expand_py

Function hkdf_expand_py 

Source
pub fn hkdf_expand_py<'py>(
    py: Python<'py>,
    algorithm: &str,
    prk: &[u8],
    info: &[u8],
    length: usize,
) -> PyResult<Bound<'py, PyBytes>>
Expand description

HKDF-Expand (RFC 5869 §2.3).

Expands a pseudorandom key prk (e.g. from :func:hkdf_extract) into length bytes of output keying material using info as a context label.

algorithm must be one of "sha256", "sha384", "sha512", etc. length must be ≤ 255 × HashLen.

import synta

prk = synta.hkdf_extract("sha256", b"salt", b"ikm")
okm = synta.hkdf_expand("sha256", prk, b"application label", 32)