sleep_parser/hash_type.rs
1/// Algorithm used for hashing the data.
2#[derive(Debug, PartialEq)]
3pub enum HashType {
4 /// [BLAKE2b](https://blake2.net/) hashing algorithm.
5 BLAKE2b,
6 /// [Ed25519](https://ed25519.cr.yp.to/) hashing algorithm.
7 Ed25519,
8 /// No hashing used.
9 None,
10}
11
12impl HashType {
13 /// Returns true if the hash is `BLAKE2b`
14 #[inline]
15 pub fn is_blake2b(&self) -> bool {
16 *self == HashType::BLAKE2b
17 }
18
19 /// Returns true if the hash is `Ed25519`
20 #[inline]
21 pub fn is_ed25519(&self) -> bool {
22 *self == HashType::Ed25519
23 }
24
25 /// Returns true if no hash function was used.
26 #[inline]
27 pub fn is_none(&self) -> bool {
28 *self == HashType::None
29 }
30}