pub enum Algorithm {
SHA1,
SHA256,
SHA512,
}
Expand description
Enum representing the supported hashing algorithms.
§Variants
SHA1
- Represents the SHA-1 hashing algorithm.SHA256
- Represents the SHA-256 hashing algorithm.SHA512
- Represents the SHA-512 hashing algorithm.
Variants§
Trait Implementations§
Source§impl AlgorithmTrait for Algorithm
impl AlgorithmTrait for Algorithm
Source§fn from_string(name: String) -> Self
fn from_string(name: String) -> Self
Source§fn hash(&self, secret: Vec<u8>, data: u64) -> Result<Vec<u8>, String>
fn hash(&self, secret: Vec<u8>, data: u64) -> Result<Vec<u8>, String>
Hashes the given secret and data using the algorithm.
§Arguments
secret
- AVec<u8>
representing the shared secret key.data
- Au64
value representing the data to be hashed.
§Returns
A Result
containing a Vec<u8>
with the hashed value if successful, or a String
with the error message if the hashing process fails.
§Errors
This function returns an error if the hashing process fails.
impl Copy for Algorithm
impl Eq for Algorithm
impl StructuralPartialEq for Algorithm
Auto Trait Implementations§
impl Freeze for Algorithm
impl RefUnwindSafe for Algorithm
impl Send for Algorithm
impl Sync for Algorithm
impl Unpin for Algorithm
impl UnwindSafe for Algorithm
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