From feb4b91ffe4a4c8d00f77362a6f9439b11da8f87 Mon Sep 17 00:00:00 2001 From: Nanak Nihal Singh Khalsa Date: Sun, 5 Feb 2023 16:06:30 -0500 Subject: [PATCH] renamed inverse to neg for more clarity --- src/lib.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index dbdf97e..f7e7396 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -182,7 +182,7 @@ impl Point { } } - pub fn inverse(&self) -> Point { + pub fn neg(&self) -> Point { let mut x_inverse = Fr::zero(); x_inverse.sub_assign(&self.x); Point { @@ -278,7 +278,6 @@ impl Point { // Converts a point to a message by dividing by 1024 (a.k.a. right-shifting by 10) pub fn to_msg(&self) -> Fr { let mut msg = self.x.clone().into_repr(); - // println!("{:?}", self.x.into_repr().shr(10)); msg.shr(10); Fr::from_repr(msg).unwrap() @@ -507,7 +506,7 @@ impl PrivateKey { let shared_secret = encrypted_point.c1.mul_scalar(&self.scalar_key()); // Subtract the shared secret encrypted_point.c2.projective().add( - &shared_secret.inverse().projective() + &shared_secret.neg().projective() ).affine() } @@ -637,7 +636,7 @@ mod tests { // assert_eq!(some_point_x_inverse, some_point.x.inverse().unwrap()); assert!(some_point.equals( some_point.projective().add(&another_point.projective()).add( - &another_point.inverse().projective()) + &another_point.neg().projective()) .affine() ));