Skip to main content

random_grease_value

Function random_grease_value 

Source
pub fn random_grease_value(rand: &impl OpenMlsRand) -> u16
Available on 32-bit or 64-bit only.
Expand description

Returns a random GREASE value from the set of valid GREASE values.

This function uses the provided random number generator to select one of the 15 valid GREASE values defined in RFC 9420.

§Arguments

  • rand - A random number generator implementing OpenMlsRand

§Returns

A randomly selected GREASE value

§Examples

use openmls::grease::random_grease_value;
use openmls_rust_crypto::RustCrypto;

let crypto = RustCrypto::default();
let grease = random_grease_value(&crypto);
assert!(openmls::grease::is_grease_value(grease));