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".

Implementations on Foreign Types§

Source§

impl CtSelect for Choice

Available on crate feature subtle only.
Source§

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

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]

Source§

impl<T> CtSelect for CtOption<T>

Available on crate feature subtle only.
Source§

fn ct_select(&self, other: &CtOption<T>, choice: Choice) -> CtOption<T>

Implementors§

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 crypto_bigint::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 T

Source§

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

Source§

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

Source§

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