Skip to main content

ConstantTimeEq

Trait ConstantTimeEq 

Source
pub trait ConstantTimeEq<Rhs: ?Sized = Self> {
    // Required method
    fn ct_eq(&self, other: &Rhs) -> Choice;

    // Provided method
    fn ct_ne(&self, other: &Rhs) -> Choice { ... }
}
Expand description

Native data-oblivious equality trait.

For slices, length is public: length mismatch may return immediately, while equal-length inputs must compare all elements.

Required Methods§

Source

fn ct_eq(&self, other: &Rhs) -> Choice

Compare without secret-dependent early exit.

Provided Methods§

Source

fn ct_ne(&self, other: &Rhs) -> Choice

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl ConstantTimeEq for [u8]

Source§

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

Source§

impl ConstantTimeEq for bool

Source§

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

Source§

impl ConstantTimeEq for i8

Source§

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

Source§

impl ConstantTimeEq for i16

Source§

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

Source§

impl ConstantTimeEq for i32

Source§

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

Source§

impl ConstantTimeEq for i64

Source§

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

Source§

impl ConstantTimeEq for i128

Source§

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

Source§

impl ConstantTimeEq for isize

Source§

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

Source§

impl ConstantTimeEq for u8

Source§

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

Source§

impl ConstantTimeEq for u16

Source§

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

Source§

impl ConstantTimeEq for u32

Source§

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

Source§

impl ConstantTimeEq for u64

Source§

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

Source§

impl ConstantTimeEq for u128

Source§

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

Source§

impl ConstantTimeEq for usize

Source§

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

Source§

impl<const N: usize> ConstantTimeEq for [u8; N]

Source§

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

Implementors§

Source§

impl ConstantTimeEq for GuardedSecretVec

Source§

impl ConstantTimeEq for LockedSecretVec

Available on non-miri and non-WebAssembly only.
Source§

impl ConstantTimeEq for SecretString

Available on crate feature alloc only.
Source§

impl ConstantTimeEq for SecretVec

Available on crate feature alloc only.
Source§

impl ConstantTimeEq<[u8]> for GuardedSecretVec

Source§

impl ConstantTimeEq<[u8]> for LockedSecretVec

Available on non-miri and non-WebAssembly only.
Source§

impl ConstantTimeEq<[u8]> for SecretVec

Available on crate feature alloc only.
Source§

impl ConstantTimeEq<str> for SecretString

Available on crate feature alloc only.
Source§

impl<'pool, const N: usize, const SLOTS: usize> ConstantTimeEq for SecretPoolSlot<'pool, N, SLOTS>

Source§

impl<'pool, const N: usize, const SLOTS: usize> ConstantTimeEq<[u8]> for SecretPoolSlot<'pool, N, SLOTS>

Source§

impl<const N: usize> ConstantTimeEq for LockedSecretBytes<N>

Source§

impl<const N: usize> ConstantTimeEq for SecretBytes<N>

Source§

impl<const N: usize> ConstantTimeEq<[u8]> for LockedSecretBytes<N>

Source§

impl<const N: usize> ConstantTimeEq<[u8]> for SecretBytes<N>