Skip to main content

CtSelect

Trait CtSelect 

Source
pub trait CtSelect: Sized {
    // Required method
    fn ct_select(&self, other: &Self, choice: Choice) -> Self;

    // Provided method
    fn ct_swap(&mut self, other: &mut Self, choice: Choice) { ... }
}
Expand description

Constant-time selection: choose between two values based on a given Choice.

This crate provides built-in implementations for the following types:

Required Methods§

Source

fn ct_select(&self, other: &Self, choice: Choice) -> Self

Select between self and other based on choice, returning a copy of the value.

§Returns

Provided Methods§

Source

fn ct_swap(&mut self, other: &mut Self, choice: Choice)

Conditionally swap self and other if choice is Choice::TRUE.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T, const N: usize> CtSelect for [T; N]
where T: CtSelectArray<N>,

Source§

fn ct_select(&self, other: &[T; N], choice: Choice) -> [T; N]

Implementors§

Source§

impl CtSelect for BoxedMontyParams

Source§

impl CtSelect for BoxedUint

Source§

impl CtSelect for Limb

Source§

impl CtSelect for Reciprocal

Source§

impl<T> CtSelect for Checked<T>
where T: CtSelect,

Source§

impl<T> CtSelect for CtOption<T>
where T: CtSelect,

Source§

impl<T> CtSelect for NonZero<T>
where T: CtSelect,

Source§

impl<T> CtSelect for Odd<T>
where T: CtSelect,

Source§

impl<T> CtSelect for Wrapping<T>
where T: CtSelect,

Source§

impl<T> CtSelect for T

Source§

impl<const LIMBS: usize> CtSelect for Int<LIMBS>

Source§

impl<const LIMBS: usize> CtSelect for Uint<LIMBS>