pub trait AlgorithmTrait {
// Required methods
fn to_string(&self) -> String;
fn from_string(s: String) -> Option<Self>
where Self: Sized;
fn hash(&self, secret: Vec<u8>, data: u64) -> Result<Vec<u8>, String>;
}Expand description
Trait for defining common behavior for different hashing algorithms.
§Methods
to_string- Converts the algorithm to its string representation.from_string- Creates an algorithm instance from its string representation.hash- Hashes the given secret and data using the algorithm.
§Errors
The hash method returns an error if the hashing process fails.