1//! Scalar types.
23use subtle::Choice;
45pub(crate) mod core;
67#[cfg(feature = "arithmetic")]
8pub(crate) mod nonzero;
910#[cfg(feature = "arithmetic")]
11use crate::ScalarArithmetic;
1213/// Scalar field element for a particular elliptic curve.
14#[cfg(feature = "arithmetic")]
15#[cfg_attr(docsrs, doc(cfg(feature = "arithmetic")))]
16pub type Scalar<C> = <C as ScalarArithmetic>::Scalar;
1718/// Bit representation of a scalar field element of a given curve.
19#[cfg(feature = "bits")]
20#[cfg_attr(docsrs, doc(cfg(feature = "bits")))]
21pub type ScalarBits<C> = ff::FieldBits<<Scalar<C> as ff::PrimeFieldBits>::ReprBits>;
2223/// Is this scalar greater than n / 2?
24///
25/// # Returns
26///
27/// - For scalars 0 through n / 2: `Choice::from(0)`
28/// - For scalars (n / 2) + 1 through n - 1: `Choice::from(1)`
29pub trait IsHigh {
30/// Is this scalar greater than or equal to n / 2?
31fn is_high(&self) -> Choice;
32}