OpenAgentID documentation
Source referencesRust module referencearsenal-crypto

arsenal-crypto · random

Declared module signatures, types, configuration, and source documentation.

Source: arsenal/crates/arsenal-crypto/src/random.rs. SHA-256: 912c264105e8593542b2c334f0efb08159e93d0491032f70319ea1fa3c53bb39.

This source reference follows declared modules and preserves feature attributes. It includes public declarations and implementation methods in those modules. Private-module exports and trait resolution still require the compiler; not every declaration is a crate-root import. Function bodies and constant values are omitted. Source comments describe their implementation context and are not a production deployment claim.

random::fill_random

Fill a buffer with cryptographically secure random bytes

Errors

Returns an error if the system random number generator fails

pub fn fill_random(buffer: &mut [u8]) -> ArsenalResult<()>;

Source line: 14.

random::random_bytes

Generate a fixed-size array of random bytes

Errors

Returns an error if the system random number generator fails

pub fn random_bytes<const N: usize>() -> ArsenalResult<[u8; N]>;

Source line: 27.

random::random_key_32

Generate a random 32-byte key

Errors

Returns an error if the system random number generator fails

pub fn random_key_32() -> ArsenalResult<[u8; 32]>;

Source line: 37.

random::random_nonce_12

Generate a random 12-byte nonce (for AES-GCM)

Errors

Returns an error if the system random number generator fails

pub fn random_nonce_12() -> ArsenalResult<[u8; 12]>;

Source line: 45.

random::random_nonce_24

Generate a random 24-byte nonce (for XChaCha20-Poly1305)

Errors

Returns an error if the system random number generator fails

pub fn random_nonce_24() -> ArsenalResult<[u8; 24]>;

Source line: 53.

random::SecureRandom

Secure random bytes that are zeroized on drop

#[derive(Clone, Zeroize)]
#[zeroize(drop)]
pub struct SecureRandom<const N: usize> {

}

Source line: 60.

random::SecureRandom<N>::generate

Generate new secure random bytes

Errors

Returns an error if the system random number generator fails

pub fn generate() -> ArsenalResult<Self>;

Source line: 69.

random::SecureRandom<N>::as_bytes

Get the bytes (use carefully)

#[must_use]
pub fn as_bytes(&self) -> &[u8; N];

Source line: 76.

random::SecureRandom<N>::len

Get the length

#[must_use]
pub const fn len(&self) -> usize;

Source line: 82.

random::SecureRandom<N>::is_empty

Check if empty (always false for N > 0)

#[must_use]
pub const fn is_empty(&self) -> bool;

Source line: 88.

random::random_u64

Generate a random u64 value

Errors

Returns an error if the system random number generator fails

pub fn random_u64() -> ArsenalResult<u64>;

Source line: 103.

random::random_u32

Generate a random u32 value

Errors

Returns an error if the system random number generator fails

pub fn random_u32() -> ArsenalResult<u32>;

Source line: 112.

random::random_range

Generate a random value in the range [0, max)

Errors

Returns an error if the system random number generator fails

pub fn random_range(max: u64) -> ArsenalResult<u64>;

Source line: 121.

On this page