Function p256::random_scalar

source ·
pub fn random_scalar(
    randomness: &mut Randomness,
    dst: &[u8]
) -> Result<P256Scalar, Error>
Expand description

Generate a random P256 scalar using rejection sampling.

Inputs:

  • randomness: Random bytes
  • dst: Domain separation tag

Outputs:

  • A random P256 scalar

Raises:

  • SamplingError: If no valid scalar can be found within 256 sampling attempts

Panics:

  • If the provided random bytes are insufficient