Struct bech32::primitives::checksum::Engine
source · pub struct Engine<Ck: Checksum> { /* private fields */ }
Expand description
A checksum engine, which can be used to compute or verify a checksum.
Use this to verify a checksum, feed it the data to be checksummed using
the Self::input_*
methods.
Implementations§
source§impl<Ck: Checksum> Engine<Ck>
impl<Ck: Checksum> Engine<Ck>
sourcepub fn input_fe(&mut self, e: Fe32)
pub fn input_fe(&mut self, e: Fe32)
Adds a single gf32 element to the checksum engine.
This is where the actual checksum computation magic happens.
sourcepub fn input_target_residue(&mut self)
pub fn input_target_residue(&mut self)
Inputs the target residue of the checksum.
Checksums are generated by appending the target residue to the input string, then computing the actual residue, and then replacing the target with the actual. This method lets us compute the actual residue without doing any string concatenations.
sourcepub fn residue(&self) -> &Ck::MidstateRepr
pub fn residue(&self) -> &Ck::MidstateRepr
Returns for the current checksum residue.
Trait Implementations§
source§impl<Ck: PartialEq + Checksum> PartialEq<Engine<Ck>> for Engine<Ck>where
Ck::MidstateRepr: PartialEq,
impl<Ck: PartialEq + Checksum> PartialEq<Engine<Ck>> for Engine<Ck>where Ck::MidstateRepr: PartialEq,
impl<Ck: Copy + Checksum> Copy for Engine<Ck>where Ck::MidstateRepr: Copy,
impl<Ck: Eq + Checksum> Eq for Engine<Ck>where Ck::MidstateRepr: Eq,
impl<Ck: Checksum> StructuralEq for Engine<Ck>
impl<Ck: Checksum> StructuralPartialEq for Engine<Ck>
Auto Trait Implementations§
impl<Ck> RefUnwindSafe for Engine<Ck>where <Ck as Checksum>::MidstateRepr: RefUnwindSafe,
impl<Ck> Send for Engine<Ck>where <Ck as Checksum>::MidstateRepr: Send,
impl<Ck> Sync for Engine<Ck>where <Ck as Checksum>::MidstateRepr: Sync,
impl<Ck> Unpin for Engine<Ck>where <Ck as Checksum>::MidstateRepr: Unpin,
impl<Ck> UnwindSafe for Engine<Ck>where <Ck as Checksum>::MidstateRepr: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more