Skip to content

Secure Random

1 min read

Import: import system.crypto;

SecureRandom

Cryptographically secure bytes with explicit entropy-source failures.

public static class SecureRandom

bytes

Returns exactly n secure bytes, or EINVAL/EENTROPY without exposing partial output.

public static fun bytes(n: int): Result<byte[], CryptoError>

fill

Fills the destination only after obtaining all requested entropy; failure preserves it.

public static fun fill(dest: byte[]): Result<Unit, CryptoError>