Skip to main content

SubtleEqExt

Trait SubtleEqExt 

Source
pub trait SubtleEqExt {
    // Required method
    fn subtle_ct_eq(&self, expected: &[u8]) -> Choice;

    // Provided method
    fn subtle_verify(&self, expected: &[u8]) -> bool { ... }
}
Expand description

Extension trait for comparing base64-ng buffers with subtle.

The comparison delegates equal-length byte comparisons to subtle::ConstantTimeEq. Length mismatch remains public and returns Choice::from(0).

Required Methods§

Source

fn subtle_ct_eq(&self, expected: &[u8]) -> Choice

Compares self with expected using subtle for equal-length inputs.

Length is public. If lengths differ, this returns Choice::from(0).

Provided Methods§

Source

fn subtle_verify(&self, expected: &[u8]) -> bool

Convenience boolean wrapper around Self::subtle_ct_eq.

Prefer Self::subtle_ct_eq when composing with other subtle decisions.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl SubtleEqExt for &[u8]

Source§

fn subtle_ct_eq(&self, expected: &[u8]) -> Choice

Source§

impl SubtleEqExt for SecretBuffer

Available on crate feature alloc only.
Source§

fn subtle_ct_eq(&self, expected: &[u8]) -> Choice

Source§

impl SubtleEqExt for [u8]

Source§

fn subtle_ct_eq(&self, expected: &[u8]) -> Choice

Source§

impl<const CAP: usize> SubtleEqExt for DecodedBuffer<CAP>

Source§

fn subtle_ct_eq(&self, expected: &[u8]) -> Choice

Source§

impl<const CAP: usize> SubtleEqExt for EncodedBuffer<CAP>

Source§

fn subtle_ct_eq(&self, expected: &[u8]) -> Choice

Implementors§