From fa2e4cf472137748975439ad7414dbc444f83b6e Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Wed, 10 Feb 2021 14:05:00 +0100 Subject: openpgp: Make HashAlgorithm::from_str ignore case. --- openpgp/src/types/mod.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'openpgp/src/types/mod.rs') 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 { - 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(()) -- cgit v1.2.3