Skip to content

Commit b1d9f0d

Browse files
committed
readme
1 parent c2d2450 commit b1d9f0d

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

README.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,29 @@
1-
# dh
1+
# dh
2+
3+
dh is a simple, ready to use Diffie-Hellman-Ephemeral implementation written in golang
4+
using MODP groups as defined in [RFC3526](https://datatracker.ietf.org/doc/html/rfc3526).
5+
6+
Example:
7+
8+
```Go
9+
import (
10+
"fmt"
11+
"reflect"
12+
"github.com/WolframAlph/dh"
13+
)
14+
15+
func main() {
16+
alice := dh.New()
17+
bob := dh.New()
18+
19+
aliceSecret := alice.ComputeSecret(bob.PublicKey)
20+
bobSecret := bob.ComputeSecret(alice.PublicKey)
21+
22+
fmt.Println(reflect.DeepEqual(aliceSecret, bobSecret))
23+
}
24+
```
25+
26+
## Notes
27+
28+
1. You must use the same MODP group on both sides, or else you
29+
end up with non-matching keys. Group #14 is used by default.

0 commit comments

Comments
 (0)