Skip to main content

ConstantTimeEquals

Trait ConstantTimeEquals 

Source
pub trait ConstantTimeEquals {
    // Required method
    fn ct_equals(&self, other: &Self) -> bool;
}
Expand description

Trait for types that can be compared in constant time

Required Methods§

Source

fn ct_equals(&self, other: &Self) -> bool

Compare two values in constant time

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<T: AsRef<[u8]>> ConstantTimeEquals for T

Implement ConstantTimeEquals for all types that implement AsRef<u8>