pub trait ConstantTimeSelect: Clone {
// Required method
fn ct_select(a: &Self, b: &Self, choice: Choice) -> Self;
// Provided methods
fn ct_assign(&mut self, other: &Self, choice: Choice) { ... }
fn ct_swap(a: &mut Self, b: &mut Self, choice: Choice) { ... }
}
Expand description
Trait for types which are conditionally selectable in constant time.
Similar to (and blanket impl’d for) subtle
’s ConditionallySelectable
trait, but without
the Copy
bound which allows it to be impl’d for heap allocated types such as BoxedUint
.
It also provides generic implementations of conditional assignment and conditional swaps.
Required Methods§
Provided Methods§
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.
Implementors§
impl ConstantTimeSelect for BoxedUint
Available on crate feature
alloc
only.NOTE: can’t impl subtle
’s ConditionallySelectable
trait due to its Copy
bound