0
0
Fork 0
mirror of https://github.com/schollz/croc.git synced 2025-10-11 13:21:00 +02:00

specify relay ports

This commit is contained in:
Zack Scholl 2018-06-30 17:58:55 -07:00
parent ae7ceca3b7
commit 1223b3e51d
3 changed files with 56 additions and 1 deletions

View file

@ -143,7 +143,8 @@ type channelData struct {
// passPhrase is used to generate a session key
passPhrase string
// sessionKey
sessionKey []byte
sessionKey []byte
// isReady specifies whether the current client
isReady bool
fileReady bool
fileMetaData FileMetaData

View file

@ -1,12 +1,61 @@
package pake
import (
"crypto/elliptic"
"testing"
"github.com/stretchr/testify/assert"
"github.com/tscholl2/siec"
)
func BenchmarkPakeSIEC255(b *testing.B) {
curve := siec.SIEC255()
for i := 0; i < b.N; i++ {
// initialize A
A, _ := Init([]byte{1, 2, 3}, 0, curve)
// initialize B
B, _ := Init([]byte{1, 2, 3}, 1, curve)
// send A's stuff to B
B.Update(A.Bytes())
// send B's stuff to A
A.Update(B.Bytes())
// send A's stuff back to B
B.Update(A.Bytes())
}
}
func BenchmarkPakeP521(b *testing.B) {
curve := elliptic.P521()
for i := 0; i < b.N; i++ {
// initialize A
A, _ := Init([]byte{1, 2, 3}, 0, curve)
// initialize B
B, _ := Init([]byte{1, 2, 3}, 1, curve)
// send A's stuff to B
B.Update(A.Bytes())
// send B's stuff to A
A.Update(B.Bytes())
// send A's stuff back to B
B.Update(A.Bytes())
}
}
func BenchmarkPakeP224(b *testing.B) {
curve := elliptic.P224()
for i := 0; i < b.N; i++ {
// initialize A
A, _ := Init([]byte{1, 2, 3}, 0, curve)
// initialize B
B, _ := Init([]byte{1, 2, 3}, 1, curve)
// send A's stuff to B
B.Update(A.Bytes())
// send B's stuff to A
A.Update(B.Bytes())
// send A's stuff back to B
B.Update(A.Bytes())
}
}
func TestPake(t *testing.T) {
curve := siec.SIEC255()
// successful (both have same k)