From d5eeb099ad2fea4b28e7a72464224e1fd5355de9 Mon Sep 17 00:00:00 2001 From: Tobin Harding Date: Mon, 21 Feb 2022 13:11:30 +0000 Subject: [PATCH] Use more intuitive local var numbering In test code we use multiple pub/sec keys. It is more intuitive if the 'secret 1' is generated by the owner of secret key 1. Refactor only, no logic changes. --- src/ecdh.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ecdh.rs b/src/ecdh.rs index 49ecb69..6540e93 100644 --- a/src/ecdh.rs +++ b/src/ecdh.rs @@ -34,8 +34,8 @@ use secp256k1_sys::types::{c_int, c_uchar, c_void}; /// let s = Secp256k1::new(); /// let (sk1, pk1) = s.generate_keypair(&mut thread_rng()); /// let (sk2, pk2) = s.generate_keypair(&mut thread_rng()); -/// let sec1 = SharedSecret::new(&pk1, &sk2); -/// let sec2 = SharedSecret::new(&pk2, &sk1); +/// let sec1 = SharedSecret::new(&pk2, &sk1); +/// let sec2 = SharedSecret::new(&pk1, &sk2); /// assert_eq!(sec1, sec2); /// # } // ``` @@ -200,8 +200,8 @@ mod tests { let (sk1, pk1) = s.generate_keypair(&mut thread_rng()); let (sk2, pk2) = s.generate_keypair(&mut thread_rng()); - let sec1 = SharedSecret::new(&pk1, &sk2); - let sec2 = SharedSecret::new(&pk2, &sk1); + let sec1 = SharedSecret::new(&pk2, &sk1); + let sec2 = SharedSecret::new(&pk1, &sk2); let sec_odd = SharedSecret::new(&pk1, &sk1); assert_eq!(sec1, sec2); assert!(sec_odd != sec2);