dalek-cryptography / x25519-dalek

X25519 elliptic curve Diffie-Hellman key exchange in pure-Rust, using curve25519-dalek.
BSD 3-Clause "New" or "Revised" License
328 stars 133 forks source link

Add PartialEq derive to PublicKey #63

Closed jack-michaud closed 4 years ago

jack-michaud commented 4 years ago

Adds PartialEq, Eq, and Hash to derive statement for PublicKey. Derives from the PartialEq impl for MontgomeryPoint.

Seemed like this was an easy win so users of this crate can use the PartialEq derive macro on structs that use PublicKey!

hdevalence commented 4 years ago

This seems good -- I think that in addition to PartialEq there should also be derived Eq and also Hash. Eq is needed to use the == operator and there's no downside to deriving Hash. (I think the only other derivable traits are Ord and PartialOrd, and those should not be implemented because there's no ordering on public keys).

jack-michaud commented 4 years ago

Thanks @hdevalence, good call -- just added Eq and Hash

hdevalence commented 4 years ago

Thanks! I'll publish this as 1.1.