Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Commit

Permalink
Some API renames
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Auernhammer committed Jul 17, 2016
1 parent d69efbe commit 88235dd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion curve25519.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type ecdh25519 struct{}

// Curve25519 creates a new ecdh.KeyExchange with
// the elliptic curve Curve25519.
func Curve25519() KeyExchange {
func X25519() KeyExchange {
return ecdh25519{}
}

Expand Down
24 changes: 12 additions & 12 deletions ecdh_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
)

// An example for the ECDH key-exchange using the curve P256.
func ExampleGenericCurve() {
p256 := GenericCurve(elliptic.P256())
func ExampleGeneric() {
p256 := Generic(elliptic.P256())

privateAlice, publicAlice, err := p256.GenerateKey(rand.Reader)
if err != nil {
Expand Down Expand Up @@ -42,8 +42,8 @@ func ExampleGenericCurve() {
}

// An example for the ECDH key-exchange using Curve25519.
func ExampleCurve25519() {
c25519 := Curve25519()
func ExampleX25519() {
c25519 := X25519()

privateAlice, publicAlice, err := c25519.GenerateKey(rand.Reader)
if err != nil {
Expand Down Expand Up @@ -72,8 +72,8 @@ func ExampleCurve25519() {

// Benchmarks

func BenchmarkCurve25519(b *testing.B) {
curve := Curve25519()
func BenchmarkX25519(b *testing.B) {
curve := X25519()
privateAlice, _, err := curve.GenerateKey(rand.Reader)
if err != nil {
b.Fatalf("Failed to generate Alice's private/public key pair: %s", err)
Expand All @@ -87,8 +87,8 @@ func BenchmarkCurve25519(b *testing.B) {
}
}

func BenchmarkKeyGenerateCurve25519(b *testing.B) {
curve := Curve25519()
func BenchmarkKeyGenerateX25519(b *testing.B) {
curve := X25519()
for i := 0; i < b.N; i++ {
_, _, err := curve.GenerateKey(rand.Reader)
if err != nil {
Expand All @@ -98,7 +98,7 @@ func BenchmarkKeyGenerateCurve25519(b *testing.B) {
}

func BenchmarkP256(b *testing.B) {
p256 := GenericCurve(elliptic.P256())
p256 := Generic(elliptic.P256())
privateAlice, _, err := p256.GenerateKey(rand.Reader)
if err != nil {
b.Fatalf("Failed to generate Alice's private/public key pair: %s", err)
Expand All @@ -114,7 +114,7 @@ func BenchmarkP256(b *testing.B) {
}

func BenchmarkKeyGenerateP256(b *testing.B) {
p256 := GenericCurve(elliptic.P256())
p256 := Generic(elliptic.P256())
for i := 0; i < b.N; i++ {
_, _, err := p256.GenerateKey(rand.Reader)
if err != nil {
Expand All @@ -124,7 +124,7 @@ func BenchmarkKeyGenerateP256(b *testing.B) {
}

func BenchmarkP521(b *testing.B) {
p521 := GenericCurve(elliptic.P256())
p521 := Generic(elliptic.P256())
privateAlice, _, err := p521.GenerateKey(rand.Reader)
if err != nil {
b.Fatalf("Failed to generate Alice's private/public key pair: %s", err)
Expand All @@ -140,7 +140,7 @@ func BenchmarkP521(b *testing.B) {
}

func BenchmarkKeyGenerateP521(b *testing.B) {
p521 := GenericCurve(elliptic.P256())
p521 := Generic(elliptic.P256())
for i := 0; i < b.N; i++ {
_, _, err := p521.GenerateKey(rand.Reader)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion generic.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func unmarshal(curve elliptic.Curve, data []byte) (x, y *big.Int) {

// GenericCurve creates a new ecdh.KeyExchange with
// generic elliptic.Curve implementations.
func GenericCurve(c elliptic.Curve) KeyExchange {
func Generic(c elliptic.Curve) KeyExchange {
if c == nil {
panic("ecdh: curve is nil")
}
Expand Down

0 comments on commit 88235dd

Please sign in to comment.