Module random

Module random 

Source
Expand description

Cryptographically secure random value generation with encoding conveniences (gated behind “rand” and encoding features).

Provides FixedRng and DynamicRng types for generating fresh random bytes. Includes built-in methods for encoding to Hex, Base64, Bech32, and Bech32m strings without exposing secret bytes.

§Examples

Generate and encode random bytes:

use secure_gate::random::FixedRng;
let hex = FixedRng::<32>::generate().into_hex();

Use with Base64:

use secure_gate::random::FixedRng;
let base64 = FixedRng::<32>::generate().into_base64();

Encode to Bech32 or Bech32m:

use secure_gate::random::FixedRng;
let bech32 = FixedRng::<32>::generate().into_bech32("example");
let bech32m = FixedRng::<32>::generate().into_bech32m("example");

Re-exports§

pub use dynamic_rng::DynamicRng;
pub use fixed_rng::FixedRng;

Modules§

dynamic_rng
fixed_rng