summaryrefslogtreecommitdiffstats
path: root/openpgp/src/types
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2020-01-02 17:21:19 +0100
committerJustus Winter <justus@sequoia-pgp.org>2020-01-02 17:52:40 +0100
commitb7bdd8e42936b8af7cb956ea9686892b3013135f (patch)
tree8f2e6280ce6cbc449329a99a861dd8aef2f4c032 /openpgp/src/types
parent60e1d354f8bde0db5f5808e395c082cfce726d0d (diff)
openpgp: Fix impl std::hash::Hash for KeyFlags.
Diffstat (limited to 'openpgp/src/types')
-rw-r--r--openpgp/src/types/key_flags.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/openpgp/src/types/key_flags.rs b/openpgp/src/types/key_flags.rs
index 9d461565..51e8a9f6 100644
--- a/openpgp/src/types/key_flags.rs
+++ b/openpgp/src/types/key_flags.rs
@@ -1,10 +1,11 @@
+use std::hash::{Hash, Hasher};
use std::fmt;
use std::cmp;
use std::ops::{BitAnd, BitOr};
/// Describes how a key may be used, and stores additional
/// information.
-#[derive(Clone, Hash)]
+#[derive(Clone)]
pub struct KeyFlags{
for_certification: bool,
for_signing: bool,
@@ -68,6 +69,19 @@ impl PartialEq for KeyFlags {
impl Eq for KeyFlags {}
+impl Hash for KeyFlags {
+ fn hash<H: Hasher>(&self, state: &mut H) {
+ self.for_certification.hash(state);
+ self.for_signing.hash(state);
+ self.for_transport_encryption.hash(state);
+ self.for_storage_encryption.hash(state);
+ self.for_authentication.hash(state);
+ self.is_split_key.hash(state);
+ self.is_group_key.hash(state);
+ self.unknown.hash(state);
+ }
+}
+
impl PartialOrd for KeyFlags {
fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
let mut a_bits = self.to_vec();