Improve Hash impl for Ciphertext.

This formulation makes it harder to forget updating the `Hash`
implementation if the `Ciphertext` type changes.
master
Andreas Fackler 7 years ago committed by Vladimir Komendantskiy
parent db1de60237
commit 34d642f709
  1. 7
      mod.rs

@ -175,9 +175,10 @@ impl<E: Engine> PartialEq for Ciphertext<E> {
impl<E: Engine> Hash for Ciphertext<E> {
fn hash<H: Hasher>(&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);
}
}

Loading…
Cancel
Save