-
Notifications
You must be signed in to change notification settings - Fork 0
/
dh_mitm_test.go
49 lines (43 loc) · 882 Bytes
/
dh_mitm_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package set5
import (
"fmt"
"math/big"
"testing"
)
func TestTestNormalComm(t *testing.T) {
normalRecv := newB()
communicate(normalRecv)
}
func TestKey0MITM(t *testing.T) {
mal := newK0Mitm()
communicate(mal)
}
func TestPrimeGMask1(t *testing.T) {
defer func() {
if r := recover(); r != nil {
fmt.Println("Recoverd from botched second leg g = 1")
}
}()
mal := newGMaskMitm(big.NewInt(1))
communicate(mal)
}
func TestPrimeGMaskP(t *testing.T) {
defer func() {
if r := recover(); r != nil {
fmt.Println("Recoverd from botched second leg g = p")
}
}()
p, _ := primes()
mal := newGMaskMitm(p)
communicate(mal)
}
func TestPrimeGMaskP_1(t *testing.T) {
defer func() {
if r := recover(); r != nil {
fmt.Println("Recoverd from botched second leg g = p-1")
}
}()
p, _ := primes()
mal := newGMaskMitm(p.Sub(p, big.NewInt(1)))
communicate(mal)
}