Documentation
¶
Overview ¶
Package test contains generic testing and benchmarking infrastructure for cryptographic groups and ciphersuites.
Index ¶
- func BitDiff(a, b []byte) float64
- func BlockCipherBench(b *testing.B, keylen int, bcipher func([]byte) cipher.Block)
- func CipherAuthenticatedEncryptionHelper(t *testing.T, newCipher func([]byte, ...interface{}) abstract.Cipher, n int, ...)
- func CipherHelloWorldHelper(t *testing.T, newCipher func([]byte, ...interface{}) abstract.Cipher, n int, ...)
- func CipherTest(t *testing.T, newCipher func([]byte, ...interface{}) abstract.Cipher)
- func HashBench(b *testing.B, hash func() hash.Hash)
- func StreamCipherBench(b *testing.B, keylen int, cipher func([]byte) cipher.Stream)
- func TestAuthenticateAndEncrypt(t *testing.T, newCipher func([]byte, ...interface{}) abstract.Cipher, n int, ...)
- func TestCompareGroups(suite abstract.Suite, g1, g2 abstract.Group)
- func TestGroup(g abstract.Group)
- func TestSuite(suite abstract.Suite)
- type GroupBench
- func (gb GroupBench) PointAdd(iters int)
- func (gb GroupBench) PointBaseMul(iters int)
- func (gb GroupBench) PointDecode(iters int)
- func (gb GroupBench) PointEncode(iters int)
- func (gb GroupBench) PointMul(iters int)
- func (gb GroupBench) PointNeg(iters int)
- func (gb GroupBench) PointPick(iters int)
- func (gb GroupBench) PointSub(iters int)
- func (gb GroupBench) ScalarAdd(iters int)
- func (gb GroupBench) ScalarDecode(iters int)
- func (gb GroupBench) ScalarDiv(iters int)
- func (gb GroupBench) ScalarEncode(iters int)
- func (gb GroupBench) ScalarInv(iters int)
- func (gb GroupBench) ScalarMul(iters int)
- func (gb GroupBench) ScalarNeg(iters int)
- func (gb GroupBench) ScalarPick(iters int)
- func (gb GroupBench) ScalarSub(iters int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BitDiff ¶
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 ¶
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 StreamCipherBench ¶
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 ¶
Test two group implementations that are supposed to be equivalent, and compare their results.
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)