curvetesting

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func B

func B(b *testing.B, f func(*testing.B, elliptic2.Curve), curves ...elliptic.Curve)

func BAdd

func BAdd(b *testing.B, c elliptic2.Curve)

Add

func BBaseMult

func BBaseMult(b *testing.B, c elliptic2.Curve)

ScalarBaseMult

func BDouble

func BDouble(b *testing.B, c elliptic2.Curve)

Double

func BMult

func BMult(b *testing.B, c elliptic2.Curve)

ScalarMult

func BOp

func BOp[
	TCurveParams any,
	TCurveArithmetic curve.CurveArithmeticBase,
	TOperator any,
](
	b *testing.B,
	fnBuild func(params *TCurveParams, fnNewOp func(c TCurveArithmetic) TOperator) TCurveArithmetic,
	fnNewOp func(c TCurveArithmetic) TOperator,
	fnBench func(b *testing.B, curve elliptic2.Curve),
	curves ...elliptic2.Curve,
)

func GetCurveType

func GetCurveType(c elliptic2.Curve) string

func GetN

func GetN(t testing.TB, c elliptic2.Curve) *big.Int

func GetName

func GetName(c elliptic2.Curve) string

func GetRandomK

func GetRandomK(t testing.TB, c elliptic2.Curve) []byte

func RequireEqual

func RequireEqual(t testing.TB, want, got *big.Int, prefix string)

func RequireGenerator

func RequireGenerator(t testing.TB, c elliptic2.Curve) bool

func RequireIsOnCurve

func RequireIsOnCurve(t testing.TB, curve elliptic2.Curve, x, y *big.Int, prefix string)

func RequireNotIsOnCurve

func RequireNotIsOnCurve(t testing.TB, curve elliptic2.Curve, x, y *big.Int, prefix string)

func RequireUnmodified

func RequireUnmodified(t testing.TB, saved, current *big.Int, prefix string)

func RequireXYEquals

func RequireXYEquals(t testing.TB, want, got *Point, prefix string)

func RequireXYUnmodified

func RequireXYUnmodified(t testing.TB, saved, current *Point, prefix string)

func TAdd

func TAdd(t *testing.T, curve elliptic2.Curve, testCase CurveTestCases)

TAdd

func TBaseMult

func TBaseMult(t *testing.T, curve elliptic2.Curve, testCase CurveTestCases)

ScalarBaseMult

func TC

func TC(t *testing.T, curves []CurveTestCases, f func(*testing.T, elliptic2.Curve, CurveTestCases))

func TDouble

func TDouble(t *testing.T, curve elliptic2.Curve, testCase CurveTestCases)

Double

func TMult

func TMult(t *testing.T, curve elliptic2.Curve, testCase CurveTestCases)

ScalarMult

func TcComputeY

func TcComputeY(t *testing.T, curveTestCases []CurveTestCases)

Test ComputeY

func TcIsOnCurve

func TcIsOnCurve(t *testing.T, curveTestCases []CurveTestCases)

Test IsOnCurve

func TcOp

func TcOp[
	TCurveParams any,
	TCurveArithmetic curve.CurveArithmeticBase,
	TOperator any,
](
	t *testing.T,
	fnBuild func(params *TCurveParams, fnNewOp func(c TCurveArithmetic) TOperator) TCurveArithmetic,
	fnNewOp func(c TCurveArithmetic) TOperator,
	fnTest func(t *testing.T, curve elliptic2.Curve, testCases CurveTestCases),
	tcs ...CurveTestCases,
)

func TestCoordinates

func TestCoordinates[
	OpType curve.Operator[C, CP],
	C any,
	CP curve.Coordinate[C],
](
	t *testing.T,
	newOp func(c curve.CurveArithmeticBase) OpType,
	curves ...elliptic2.Curve,
)

func TestCurveMadd

func TestCurveMadd(t *testing.T, curves ...curve.CurveArithmeticBase)

func TestMadd

func TestMadd[
	MaddOpType curve.MaddOperator[C, CP],
	OpType curve.Operator[C, CP],
	C any,
	CP curve.Coordinate[C],
](
	t *testing.T,
	newOp func(c curve.CurveArithmeticBase) OpType,
	curves ...elliptic2.Curve,
)

func W

func W[
	TCurveArithmetic curve.CurveArithmeticBase,
	TOperator any,
](
	fnNewOp func(c TCurveArithmetic) TOperator,
) func(c curve.CurveArithmeticBase) TOperator

Types

type CurveTestCases

type CurveTestCases struct {
	Curve      elliptic2.Curve
	K          [][]byte
	P          []Point // P[0] = G * k[0], P[1] = P[0] * k[1], ...
	Add        []Point // Adds[0] = P[0] + P[0], Adds[1] = Adds[0] + P[1], ...
	Double     []Point // Double[0] = 2P[0], Double[1] = 2P[1], ...
	ScalarMult []Point // ScalarMult[0] = P[0] * k[0], ScalarMult[1] = ScalarMult[0] * k[1], ...
	InvalidP   []Point
}

type Point

type Point struct {
	X, Y *big.Int
}

func GetGenerator

func GetGenerator(c elliptic2.Curve) *Point

func P

func P(xHex, yHex string) Point

ParsePoint

func (*Point) Set

func (p *Point) Set(other Point)

type ScalarBaseMultTestCase

type ScalarBaseMultTestCase struct {
	K []byte
	P Point
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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