You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuweni.apache.org by to...@apache.org on 2020/06/27 23:08:46 UTC

[incubator-tuweni] branch master updated: Add diffie helman object coverage

This is an automated email from the ASF dual-hosted git repository.

toulmean pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-tuweni.git


The following commit(s) were added to refs/heads/master by this push:
     new 6f7a372  Add diffie helman object coverage
     new 4eb92d1  Merge pull request #107 from atoulme/add_dh_coverage
6f7a372 is described below

commit 6f7a3720aa0bbb9735db6780342749f3ad81101d
Author: Antoine Toulme <an...@lunar-ocean.com>
AuthorDate: Sat Jun 27 15:46:40 2020 -0700

    Add diffie helman object coverage
---
 .../tuweni/crypto/sodium/DiffieHelmanTest.java     | 24 ++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/crypto/src/test/java/org/apache/tuweni/crypto/sodium/DiffieHelmanTest.java b/crypto/src/test/java/org/apache/tuweni/crypto/sodium/DiffieHelmanTest.java
index cc053c5..c50746d 100644
--- a/crypto/src/test/java/org/apache/tuweni/crypto/sodium/DiffieHelmanTest.java
+++ b/crypto/src/test/java/org/apache/tuweni/crypto/sodium/DiffieHelmanTest.java
@@ -35,4 +35,28 @@ class DiffieHelmanTest {
 
     assertEquals(scalar1, scalar2);
   }
+
+  @Test
+  void testEquals() {
+    DiffieHelman.KeyPair keyPair = DiffieHelman.KeyPair.random();
+    DiffieHelman.KeyPair keyPair2 = DiffieHelman.KeyPair.forSecretKey(keyPair.secretKey());
+    assertEquals(keyPair, keyPair2);
+    assertEquals(keyPair.hashCode(), keyPair2.hashCode());
+  }
+
+  @Test
+  void testEqualsSecretKey() {
+    DiffieHelman.KeyPair keyPair = DiffieHelman.KeyPair.random();
+    DiffieHelman.KeyPair keyPair2 = DiffieHelman.KeyPair.forSecretKey(keyPair.secretKey());
+    assertEquals(keyPair.secretKey(), keyPair2.secretKey());
+    assertEquals(keyPair.hashCode(), keyPair2.hashCode());
+  }
+
+  @Test
+  void testEqualsPublicKey() {
+    DiffieHelman.KeyPair keyPair = DiffieHelman.KeyPair.random();
+    DiffieHelman.KeyPair keyPair2 = DiffieHelman.KeyPair.forSecretKey(keyPair.secretKey());
+    assertEquals(keyPair.publicKey(), keyPair2.publicKey());
+    assertEquals(keyPair.hashCode(), keyPair2.hashCode());
+  }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tuweni.apache.org
For additional commands, e-mail: commits-help@tuweni.apache.org