Skip to content
Snippets Groups Projects
Commit 02f86394 authored by Benjamin Wenger's avatar Benjamin Wenger
Browse files

fixed DH benchmark

parent beb7556a
No related branches found
No related tags found
No related merge requests found
......@@ -237,9 +237,7 @@ func TestDHNodeKeys(t *testing.T) {
}*/
func BenchmarkCreateDHSessionKey(b *testing.B) {
const iterations = 1
b.StopTimer()
primeString := "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" +
"29024E088A67CC74020BBEA63B139B22514A08798E3404DD" +
"EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" +
......@@ -256,12 +254,23 @@ func BenchmarkCreateDHSessionKey(b *testing.B) {
g := large.NewInt(2)
grp := cyclic.NewGroup(p, g)
pubkeys := make([]*cyclic.Int, b.N)
privkeys := make([]*cyclic.Int, b.N)
for i := 0; i < b.N; i++ {
// Creation of two different DH Key Pairs with valid parameters
_, pubKey := CreateDHKeyPair(grp)
privKey, _ := CreateDHKeyPair(grp)
b.ResetTimer()
pubkeys[i] = pubKey
privkeys[i] = privKey
}
b.StartTimer()
for i := 0; i < b.N; i++ {
CreateDHSessionKey(pubKey, privKey, grp)
CreateDHSessionKey(pubkeys[i], privkeys[i], grp)
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment