pub struct ChecksumEngine { /* private fields */ }Expand description
An engine which consumes one GF32 character at a time, and produces a residue modulo some generator
Implementations§
Source§impl Engine
impl Engine
pub fn new_codex32_short() -> Engine
pub fn new_codex32_long() -> Engine
Sourcepub fn force_residue_to_zero(&mut self)
pub fn force_residue_to_zero(&mut self)
When computing checksums of “diffs” you do may want to set the highest-degree coefficient of the polynomial to 1.
If you do not know exactly why you are using this function, you should not use it.
Sourcepub fn into_residue(self) -> Vec<Fe>
pub fn into_residue(self) -> Vec<Fe>
Extracts the residue from a checksum engine
Sourcepub fn is_valid(&self) -> bool
pub fn is_valid(&self) -> bool
Determines whether the residue matches the target value for the checksum
If you need the actual residue, e.g. for error correction,
call the into_residue function (which will consume the
engine).
Sourcepub fn input_hrp(&mut self, hrp: &str) -> Result<(), Error>
pub fn input_hrp(&mut self, hrp: &str) -> Result<(), Error>
Initializes the checksum engine by loading an HRP into it
Sourcepub fn input_char(&mut self, c: char) -> Result<(), Error>
pub fn input_char(&mut self, c: char) -> Result<(), Error>
Adds a single character to the checksum engine
Sourcepub fn input_data_str(&mut self, s: &str) -> Result<(), Error>
pub fn input_data_str(&mut self, s: &str) -> Result<(), Error>
Adds an entire string to the engine, counting each character as a data character (not an HRP).
Sourcepub fn input_own_target(&mut self)
pub fn input_own_target(&mut self)
Adds the target residue to the end of the input string