std/entropy

Types

Entropy

@unsafeGuarantee(Copy, Send, Sync)
pub type Entropy

CSPRNG capability, obtained from host.entropy(); hosted only. std/random is a deterministic splitmix64 and must not be used for keys or nonces. No bare variant: a freestanding target has no entropy source in std (an SGX enclave supplies its own through Runtime.randomBytes). Safety: a stateless capability marker; every call it makes is independent, so sharing or duplicating it is free.

Entropy.bytes

pub fn Entropy.bytes(self, n: usize) -> Bytes!

n cryptographically random bytes from the OS: getrandom(2), falling back to /dev/urandom when the syscall itself fails; the scratch buffer is erased before it is freed.

Entropy.u64

pub fn Entropy.u64(self) -> u64!

One random u64 from the OS.