~elementary-os/elementaryos/os-patch-aptly-xenial

« back to all changes in this revision

Viewing changes to src/github.com/smira/aptly/_vendor/src/golang.org/x/crypto/curve25519/curve25519_test.go

  • Committer: RabbitBot
  • Date: 2016-07-19 12:29:41 UTC
  • Revision ID: rabbitbot@elementary.io-20160719122941-z6gaxs7nzgmratry
Initial import, version 0.9.6-1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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.
 
4
 
 
5
package curve25519
 
6
 
 
7
import (
 
8
        "fmt"
 
9
        "testing"
 
10
)
 
11
 
 
12
const expectedHex = "89161fde887b2b53de549af483940106ecc114d6982daa98256de23bdf77661a"
 
13
 
 
14
func 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
}