From 34d642f7094c43477872aea4665eb7f0b9e1c27d Mon Sep 17 00:00:00 2001 From: Andreas Fackler Date: Tue, 19 Jun 2018 12:27:59 +0200 Subject: [PATCH] Improve Hash impl for Ciphertext. This formulation makes it harder to forget updating the `Hash` implementation if the `Ciphertext` type changes. --- mod.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mod.rs b/mod.rs index 2827de0..cdab4c3 100644 --- a/mod.rs +++ b/mod.rs @@ -175,9 +175,10 @@ impl PartialEq for Ciphertext { impl Hash for Ciphertext { fn hash(&self, state: &mut H) { - self.0.into_affine().into_compressed().as_ref().hash(state); - self.1.hash(state); - self.2.into_affine().into_compressed().as_ref().hash(state); + let Ciphertext(ref u, ref v, ref w) = *self; + u.into_affine().into_compressed().as_ref().hash(state); + v.hash(state); + w.into_affine().into_compressed().as_ref().hash(state); } }