From beb7556a82c6e64d5e7639f25405f8eec133519f Mon Sep 17 00:00:00 2001
From: Benjamin Wenger <ben@elixxir.ioo>
Date: Tue, 18 Aug 2020 16:47:43 -0700
Subject: [PATCH] added DH benchmark

---
 diffieHellman/dhkx_test.go | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/diffieHellman/dhkx_test.go b/diffieHellman/dhkx_test.go
index d2a68e04..c4ddc259 100644
--- a/diffieHellman/dhkx_test.go
+++ b/diffieHellman/dhkx_test.go
@@ -235,3 +235,33 @@ func TestDHNodeKeys(t *testing.T) {
 
 	println("TestDHNodeKeys():", pass, "out of", tests, "tests passed.")
 }*/
+
+func BenchmarkCreateDHSessionKey(b *testing.B) {
+
+	const iterations = 1
+
+	primeString := "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" +
+		"29024E088A67CC74020BBEA63B139B22514A08798E3404DD" +
+		"EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" +
+		"E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" +
+		"EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D" +
+		"C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F" +
+		"83655D23DCA3AD961C62F356208552BB9ED529077096966D" +
+		"670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B" +
+		"E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9" +
+		"DE2BCBF6955817183995497CEA956AE515D2261898FA0510" +
+		"15728E5A8AACAA68FFFFFFFFFFFFFFFF"
+	p := large.NewInt(1)
+	p.SetString(primeString, 16)
+	g := large.NewInt(2)
+	grp := cyclic.NewGroup(p, g)
+
+	// Creation of two different DH Key Pairs with valid parameters
+	_, pubKey := CreateDHKeyPair(grp)
+	privKey, _ := CreateDHKeyPair(grp)
+
+	b.ResetTimer()
+
+	CreateDHSessionKey(pubKey, privKey, grp)
+
+}
-- 
GitLab