pub struct AesCtrKeyGenerator { /* private fields */ }Expand description
Hardware-only AES-256-CTR fast random generator.
The state contains a 128-bit counter, AES-256 encryption round keys, and a small buffered-output block. It does not contain a software AES fallback or a runtime enum that can hold one.
Implementations§
Source§impl AesCtrKeyGenerator
impl AesCtrKeyGenerator
Sourcepub fn hardware_available() -> bool
pub fn hardware_available() -> bool
Returns whether this process currently exposes the required AES hardware functionality for the AES-CTR backend.
Sourcepub const fn state_layout() -> StateLayout
pub const fn state_layout() -> StateLayout
Returns the state layout for this owned generator type.
Sourcepub fn from_os_entropy() -> Result<Self, Error>
pub fn from_os_entropy() -> Result<Self, Error>
Seeds a new AES-CTR generator from OS entropy.
§Errors
Returns Error::UnsupportedCpu if the required AES hardware support is
unavailable. Returns Error::OsEntropy if the platform entropy source
cannot provide a seed.
Sourcepub fn from_seed(seed: &mut [u8; 48]) -> Result<Self, Error>
pub fn from_seed(seed: &mut [u8; 48]) -> Result<Self, Error>
Seeds a new AES-CTR generator from explicit seed material and zeroizes the provided seed before returning.
seed[..32] is the AES-256 key and seed[32..] is the initial 128-bit
little-endian counter. This constructor exists for deterministic tests
and benchmarks; production callers should use Self::from_os_entropy.
§Errors
Returns Error::UnsupportedCpu if the required AES hardware support is
unavailable.