Skip to main content

Host

pub trait Host {
    // Required methods
    fn make_rejecting_digest(
        &mut self,
    ) -> Result<Result<Resource<Digest>, Error>>;
    fn make_mitigating_digest(
        &mut self,
    ) -> Result<Result<Resource<Digest>, Error>>;
}

Required Methods§

Source

fn make_rejecting_digest(&mut self) -> Result<Result<Resource<Digest>, Error>>

Mint a SHA-1 digest that rejects on a detected collision attack: compute fails with error.extension — origin "polymorph:webcrypto", name "collision-detected" — for input carrying an attack pattern, and returns the standard SHA-1 digest for everything else. Choose this posture to surface an attack as a diagnosable error.

Source

fn make_mitigating_digest(&mut self) -> Result<Result<Resource<Digest>, Error>>

Mint a SHA-1 digest that mitigates a detected collision attack: for input carrying an attack pattern, compute returns the sha1dc safe hash — a deterministic hardened variant the attack was not engineered against — and the standard SHA-1 digest for everything else. Two parties hashing the same attacked input agree on its safe hash, so pipelines keep flowing while the colliding pair no longer collides. Choose this posture for content addressing, where an error would wedge the pipeline; the cost is that an attack surfaces as an external hash mismatch rather than a named error.

Implementations on Foreign Types§

Source§

impl<_T: Host + ?Sized> Host for &mut _T

Source§

fn make_rejecting_digest(&mut self) -> Result<Result<Resource<Digest>, Error>>

Mint a SHA-1 digest that rejects on a detected collision attack: compute fails with error.extension — origin "polymorph:webcrypto", name "collision-detected" — for input carrying an attack pattern, and returns the standard SHA-1 digest for everything else. Choose this posture to surface an attack as a diagnosable error.

Source§

fn make_mitigating_digest(&mut self) -> Result<Result<Resource<Digest>, Error>>

Mint a SHA-1 digest that mitigates a detected collision attack: for input carrying an attack pattern, compute returns the sha1dc safe hash — a deterministic hardened variant the attack was not engineered against — and the standard SHA-1 digest for everything else. Two parties hashing the same attacked input agree on its safe hash, so pipelines keep flowing while the colliding pair no longer collides. Choose this posture for content addressing, where an error would wedge the pipeline; the cost is that an attack surfaces as an external hash mismatch rather than a named error.

Implementors§