libgo: update to Go 1.11
[official-gcc.git] / libgo / go / golang_org / x / crypto / curve25519 / curve25519_test.go
blob051a8301f080ffe95e1645eae968a746395745ee
1 // Copyright 2012 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 package curve25519
7 import (
8 "fmt"
9 "testing"
12 const expectedHex = "89161fde887b2b53de549af483940106ecc114d6982daa98256de23bdf77661a"
14 func TestBaseScalarMult(t *testing.T) {
15 var a, b [32]byte
16 in := &a
17 out := &b
18 a[0] = 1
20 for i := 0; i < 200; i++ {
21 ScalarBaseMult(out, in)
22 in, out = out, in
25 result := fmt.Sprintf("%x", in[:])
26 if result != expectedHex {
27 t.Errorf("incorrect result: got %s, want %s", result, expectedHex)
31 func BenchmarkScalarBaseMult(b *testing.B) {
32 var in, out [32]byte
33 in[0] = 1
35 b.SetBytes(32)
36 for i := 0; i < b.N; i++ {
37 ScalarBaseMult(&out, &in)