Enum checksums::Algorithm [] [src]

pub enum Algorithm {
    SHA1,
    SHA2256,
    SHA2512,
    SHA3256,
    SHA3512,
    BLAKE,
    BLAKE2,
    CRC64,
    CRC32,
    CRC16,
    CRC8,
    MD5,
    XOR8,
}

A hashing algorithm.

Examples

assert_eq!(Algorithm::from_str("SHA1"), Ok(Algorithm::SHA1));
assert_eq!(Algorithm::from_str("SHA-1"), Ok(Algorithm::SHA1));

assert_eq!(Algorithm::from_str("SHA2"), Ok(Algorithm::SHA2512));
assert_eq!(Algorithm::from_str("SHA-2"), Ok(Algorithm::SHA2512));

assert_eq!(Algorithm::from_str("BLAKE"), Ok(Algorithm::BLAKE));
assert_eq!(Algorithm::from_str("BLAKE2"), Ok(Algorithm::BLAKE2));

assert_eq!(Algorithm::from_str("MD5"), Ok(Algorithm::MD5));

Variants

SHA1
SHA2256

SHA2-256

SHA2512

SHA2-512

SHA3256

SHA3-256

SHA3512

SHA3-512

BLAKE
BLAKE2
CRC64
CRC32
CRC16
CRC8
MD5
XOR8

Methods

impl Algorithm
[src]

fn size(&self) -> usize

Length, in bytes, of the algorithm's output hex string

Trait Implementations

impl FromStr for Algorithm
[src]

type Err = String

The associated error which can be returned from parsing.

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more

Derived Implementations

impl Eq for Algorithm
[src]

impl PartialEq for Algorithm
[src]

fn eq(&self, __arg_0: &Algorithm) -> bool

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &Rhs) -> bool
1.0.0

This method tests for !=.

impl Hash for Algorithm
[src]

fn hash<__H: Hasher>(&self, __arg_0: &mut __H)

Feeds this value into the state given, updating the hasher as necessary.

fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher
1.3.0

Feeds a slice of this type into the state provided.

impl Copy for Algorithm
[src]

impl Clone for Algorithm
[src]

fn clone(&self) -> Algorithm

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more

impl Debug for Algorithm
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.