summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2021-02-10 14:05:00 +0100
committerJustus Winter <justus@sequoia-pgp.org>2021-02-10 15:34:52 +0100
commitfa2e4cf472137748975439ad7414dbc444f83b6e (patch)
treea2b4eb0514657447800f6c818aa7ae453f40d8e4
parent5304311e6a6009b5badda3fac5b63fb9756c743b (diff)
openpgp: Make HashAlgorithm::from_str ignore case.
-rw-r--r--openpgp/src/types/mod.rs14
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(())