X-Git-Url: http://www.git.cypherpunks.ru/?p=govpn.git;a=blobdiff_plain;f=src%2Fcypherpunks.ru%2Fgovpn%2Fencless_test.go;h=fc00d2708d753735bb501e3886c1ee8d4df1cde5;hp=1f9fece30e3207999ec3a01a6d779888299d15e6;hb=0bf04621961589bc735dc8bd8a075d7db24c4178;hpb=4cc7cf27a64355bbe1f64418a55e860baeb63ac0 diff --git a/src/cypherpunks.ru/govpn/encless_test.go b/src/cypherpunks.ru/govpn/encless_test.go index 1f9fece..fc00d27 100644 --- a/src/cypherpunks.ru/govpn/encless_test.go +++ b/src/cypherpunks.ru/govpn/encless_test.go @@ -35,9 +35,9 @@ func init() { } func TestEnclessSymmetric(t *testing.T) { - nonce := make([]byte, 8) + nonce := new([16]byte) f := func(pktNum uint64, in []byte) bool { - binary.BigEndian.PutUint64(nonce, pktNum) + binary.BigEndian.PutUint64(nonce[8:], pktNum) encoded, err := EnclessEncode(testKey, nonce, in) if err != nil { return false @@ -54,9 +54,9 @@ func TestEnclessSymmetric(t *testing.T) { } func BenchmarkEnclessEncode(b *testing.B) { - nonce := make([]byte, 8) + nonce := new([16]byte) data := make([]byte, 128) - io.ReadFull(Rand, nonce) + io.ReadFull(Rand, nonce[8:]) io.ReadFull(Rand, data) b.ResetTimer() for i := 0; i < b.N; i++ { @@ -65,9 +65,9 @@ func BenchmarkEnclessEncode(b *testing.B) { } func BenchmarkEnclessDecode(b *testing.B) { - nonce := make([]byte, 8) + nonce := new([16]byte) data := make([]byte, 128) - io.ReadFull(Rand, nonce) + io.ReadFull(Rand, nonce[8:]) io.ReadFull(Rand, data) encoded, _ := EnclessEncode(testKey, nonce, data) b.ResetTimer()