diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2021-02-10 14:05:00 +0100 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2021-02-10 15:34:52 +0100 |
commit | fa2e4cf472137748975439ad7414dbc444f83b6e (patch) | |
tree | a2b4eb0514657447800f6c818aa7ae453f40d8e4 /openpgp/src | |
parent | 5304311e6a6009b5badda3fac5b63fb9756c743b (diff) |
openpgp: Make HashAlgorithm::from_str ignore case.
Diffstat (limited to 'openpgp/src')
-rw-r--r-- | openpgp/src/types/mod.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/openpgp/src/types/mod.rs b/openpgp/src/types/mod.rs index 951cfa8e..91749dd2 100644 --- a/openpgp/src/types/mod.rs +++ b/openpgp/src/types/mod.rs @@ -1017,19 +1017,19 @@ impl FromStr for HashAlgorithm { type Err = (); fn from_str(s: &str) -> result::Result<Self, ()> { - if s == "MD5" { + if s.eq_ignore_ascii_case("MD5") { Ok(HashAlgorithm::MD5) - } else if s == "SHA1" { + } else if s.eq_ignore_ascii_case("SHA1") { Ok(HashAlgorithm::SHA1) - } else if s == "RipeMD160" { + } else if s.eq_ignore_ascii_case("RipeMD160") { Ok(HashAlgorithm::RipeMD) - } else if s == "SHA256" { + } else if s.eq_ignore_ascii_case("SHA256") { Ok(HashAlgorithm::SHA256) - } else if s == "SHA384" { + } else if s.eq_ignore_ascii_case("SHA384") { Ok(HashAlgorithm::SHA384) - } else if s == "SHA512" { + } else if s.eq_ignore_ascii_case("SHA512") { Ok(HashAlgorithm::SHA512) - } else if s == "SHA224" { + } else if s.eq_ignore_ascii_case("SHA224") { Ok(HashAlgorithm::SHA224) } else { Err(()) |