test

package
v0.0.0-...-0b3308b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 19, 2017 License: MPL-2.0 Imports: 8 Imported by: 1

Documentation

Overview

Package test contains generic testing and benchmarking infrastructure for cryptographic groups and ciphersuites.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BitDiff

func BitDiff(a, b []byte) float64

Compares the bits between two arrays returning the fraction of differences. If the two arrays are not of the same length no comparison is made and a -1 is returned.

func BlockCipherBench

func BlockCipherBench(b *testing.B, keylen int,
	bcipher func([]byte) cipher.Block)

Benchmark a block cipher operating in counter mode.

func CipherAuthenticatedEncryptionHelper

func CipherAuthenticatedEncryptionHelper(t *testing.T,
	newCipher func([]byte, ...interface{}) abstract.Cipher,
	n int, bitdiff float64)

Iterate through various sized messages and verify that encryption and authentication work

func CipherHelloWorldHelper

func CipherHelloWorldHelper(t *testing.T,
	newCipher func([]byte, ...interface{}) abstract.Cipher,
	n int, bitdiff float64)

Tests a Cipher can encrypt and decrypt

func CipherTest

func CipherTest(t *testing.T,
	newCipher func([]byte, ...interface{}) abstract.Cipher)

func HashBench

func HashBench(b *testing.B, hash func() hash.Hash)

func StreamCipherBench

func StreamCipherBench(b *testing.B, keylen int,
	cipher func([]byte) cipher.Stream)

Benchmark a stream cipher.

func TestAuthenticateAndEncrypt

func TestAuthenticateAndEncrypt(t *testing.T,
	newCipher func([]byte, ...interface{}) abstract.Cipher,
	n int, bitdiff float64, text []byte)

Tests a Cipher: 1) Encryption / decryption work 2) Encryption / decryption with different key don't work 3) Changing a bit in the ciphertext or mac results in failed mac check 4) Different keys produce sufficiently random output

func TestCompareGroups

func TestCompareGroups(suite abstract.Suite, g1, g2 abstract.Group)

Test two group implementations that are supposed to be equivalent, and compare their results.

func TestGroup

func TestGroup(g abstract.Group)

Apply a generic set of validation tests to a cryptographic Group.

func TestSuite

func TestSuite(suite abstract.Suite)

Apply a standard set of validation tests to a ciphersuite.

Types

type GroupBench

type GroupBench struct {
	X, Y abstract.Point

	Xe []byte // encoded Point
	// contains filtered or unexported fields
}

A generic benchmark suite for abstract groups.

func NewGroupBench

func NewGroupBench(g abstract.Group) *GroupBench

func (GroupBench) PointAdd

func (gb GroupBench) PointAdd(iters int)

func (GroupBench) PointBaseMul

func (gb GroupBench) PointBaseMul(iters int)

func (GroupBench) PointDecode

func (gb GroupBench) PointDecode(iters int)

func (GroupBench) PointEncode

func (gb GroupBench) PointEncode(iters int)

func (GroupBench) PointMul

func (gb GroupBench) PointMul(iters int)

func (GroupBench) PointNeg

func (gb GroupBench) PointNeg(iters int)

func (GroupBench) PointPick

func (gb GroupBench) PointPick(iters int)

func (GroupBench) PointSub

func (gb GroupBench) PointSub(iters int)

func (GroupBench) ScalarAdd

func (gb GroupBench) ScalarAdd(iters int)

func (GroupBench) ScalarDecode

func (gb GroupBench) ScalarDecode(iters int)

func (GroupBench) ScalarDiv

func (gb GroupBench) ScalarDiv(iters int)

func (GroupBench) ScalarEncode

func (gb GroupBench) ScalarEncode(iters int)

func (GroupBench) ScalarInv

func (gb GroupBench) ScalarInv(iters int)

func (GroupBench) ScalarMul

func (gb GroupBench) ScalarMul(iters int)

func (GroupBench) ScalarNeg

func (gb GroupBench) ScalarNeg(iters int)

func (GroupBench) ScalarPick

func (gb GroupBench) ScalarPick(iters int)

func (GroupBench) ScalarSub

func (gb GroupBench) ScalarSub(iters int)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL