Skip to content

Crypto

Wrapper for the global crypto object. Requires the random feature.

Constructor

rust
let crypto = Crypto::new()?;

Methods

get_random_values

Fills a buffer with cryptographically secure random bytes. Maximum 65,536 bytes per call.

rust
let mut buf = [0u8; 32];
crypto.get_random_values(&mut buf)?;

random_uuid

Generates a UUID v4 string.

rust
let uuid = crypto.random_uuid()?;
// e.g. "550e8400-e29b-41d4-a716-446655440000"