blob: 14b0ee87cddc9ad200953f0c00520cbe9097976b [file] [log] [blame]
Adam Langley124e52d2012-03-12 10:59:04 -04001// 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.
4
5package curve25519
6
7import (
8 "fmt"
9 "testing"
10)
11
12const expectedHex = "89161fde887b2b53de549af483940106ecc114d6982daa98256de23bdf77661a"
13
14func TestBaseScalarMult(t *testing.T) {
15 var a, b [32]byte
16 in := &a
17 out := &b
18 a[0] = 1
19
20 for i := 0; i < 200; i++ {
21 ScalarBaseMult(out, in)
22 in, out = out, in
23 }
24
25 result := fmt.Sprintf("%x", in[:])
26 if result != expectedHex {
27 t.Errorf("incorrect result: got %s, want %s", result, expectedHex)
28 }
29}