当前位置: 首页>>代码示例>>Golang>>正文


Golang test.NewGroupBench函数代码示例

本文整理汇总了Golang中github.com/dedis/crypto/test.NewGroupBench函数的典型用法代码示例。如果您正苦于以下问题:Golang NewGroupBench函数的具体用法?Golang NewGroupBench怎么用?Golang NewGroupBench使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了NewGroupBench函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: TestP224

// +build experimental

package openssl

import (
	"testing"

	"github.com/dedis/crypto/test"
)

var testSuite = NewAES128SHA256P256()
var groupBench = test.NewGroupBench(testSuite)

func TestP224(t *testing.T) { test.TestGroup(new(curve).InitP224()) }
func TestP256(t *testing.T) { test.TestGroup(new(curve).InitP256()) }
func TestP384(t *testing.T) { test.TestGroup(new(curve).InitP384()) }
func TestP521(t *testing.T) { test.TestGroup(new(curve).InitP521()) }

func TestSuite(t *testing.T) { test.TestSuite(testSuite) }

func BenchmarkScalarAdd(b *testing.B)    { groupBench.ScalarAdd(b.N) }
func BenchmarkScalarSub(b *testing.B)    { groupBench.ScalarSub(b.N) }
func BenchmarkScalarNeg(b *testing.B)    { groupBench.ScalarNeg(b.N) }
func BenchmarkScalarMul(b *testing.B)    { groupBench.ScalarMul(b.N) }
func BenchmarkScalarDiv(b *testing.B)    { groupBench.ScalarDiv(b.N) }
func BenchmarkScalarInv(b *testing.B)    { groupBench.ScalarInv(b.N) }
func BenchmarkScalarPick(b *testing.B)   { groupBench.ScalarPick(b.N) }
func BenchmarkScalarEncode(b *testing.B) { groupBench.ScalarEncode(b.N) }
func BenchmarkScalarDecode(b *testing.B) { groupBench.ScalarDecode(b.N) }

func BenchmarkPointAdd(b *testing.B)     { groupBench.PointAdd(b.N) }
开发者ID:LegoShrimp,项目名称:crypto,代码行数:31,代码来源:curve_test.go

示例2: BenchmarkPointBaseMul

func BenchmarkPointBaseMul(b *testing.B) {
	test.NewGroupBench(testSuite).PointBaseMul(b.N)
}
开发者ID:LegoShrimp,项目名称:crypto,代码行数:3,代码来源:curve_test.go

示例3: BenchmarkPointDecode

func BenchmarkPointDecode(b *testing.B) {
	test.NewGroupBench(testSuite).PointDecode(b.N)
}
开发者ID:LegoShrimp,项目名称:crypto,代码行数:3,代码来源:curve_test.go

示例4: BenchmarkScalarDecode

func BenchmarkScalarDecode(b *testing.B) {
	test.NewGroupBench(testSuite).ScalarDecode(b.N)
}
开发者ID:LegoShrimp,项目名称:crypto,代码行数:3,代码来源:curve_test.go

示例5: TestElligator1

		}
		//println("")
	}
}

func TestElligator1(t *testing.T) {
	testHiding(new(ExtendedCurve).Init(Param1174(), true), 10)
}

func TestElligator2(t *testing.T) {
	testHiding(new(ExtendedCurve).Init(Param25519(), true), 10)
}

// Benchmark contrasting implementations of the Ed25519 curve

var projBench = test.NewGroupBench(new(ProjectiveCurve).Init(Param25519(), false))
var extBench = test.NewGroupBench(new(ExtendedCurve).Init(Param25519(), false))
var optBench = test.NewGroupBench(new(ed25519.Curve))

func BenchmarkPointAddProjective(b *testing.B) { projBench.PointAdd(b.N) }
func BenchmarkPointAddExtended(b *testing.B)   { extBench.PointAdd(b.N) }
func BenchmarkPointAddOptimized(b *testing.B)  { optBench.PointAdd(b.N) }

func BenchmarkPointMulProjective(b *testing.B) { projBench.PointMul(b.N) }
func BenchmarkPointMulExtended(b *testing.B)   { extBench.PointMul(b.N) }
func BenchmarkPointMulOptimized(b *testing.B)  { optBench.PointMul(b.N) }

func BenchmarkPointBaseMulProjective(b *testing.B) { projBench.PointBaseMul(b.N) }
func BenchmarkPointBaseMulExtended(b *testing.B)   { extBench.PointBaseMul(b.N) }
func BenchmarkPointBaseMulOptimized(b *testing.B)  { optBench.PointBaseMul(b.N) }
开发者ID:Liamsi,项目名称:crypto,代码行数:30,代码来源:curve_test.go

示例6: TestQR512

package nist

import (
	"testing"

	"github.com/dedis/crypto/test"
)

var testQR512 = NewAES128SHA256QR512()

func TestQR512(t *testing.T) { test.TestSuite(testQR512) }

var testP256 = NewAES128SHA256P256()
var benchP256 = test.NewGroupBench(testP256)

func TestP256(t *testing.T) { test.TestSuite(testP256) }

func BenchmarkScalarAdd(b *testing.B)    { benchP256.ScalarAdd(b.N) }
func BenchmarkScalarSub(b *testing.B)    { benchP256.ScalarSub(b.N) }
func BenchmarkScalarNeg(b *testing.B)    { benchP256.ScalarNeg(b.N) }
func BenchmarkScalarMul(b *testing.B)    { benchP256.ScalarMul(b.N) }
func BenchmarkScalarDiv(b *testing.B)    { benchP256.ScalarDiv(b.N) }
func BenchmarkScalarInv(b *testing.B)    { benchP256.ScalarInv(b.N) }
func BenchmarkScalarPick(b *testing.B)   { benchP256.ScalarPick(b.N) }
func BenchmarkScalarEncode(b *testing.B) { benchP256.ScalarEncode(b.N) }
func BenchmarkScalarDecode(b *testing.B) { benchP256.ScalarDecode(b.N) }

func BenchmarkPointAdd(b *testing.B)     { benchP256.PointAdd(b.N) }
func BenchmarkPointSub(b *testing.B)     { benchP256.PointSub(b.N) }
func BenchmarkPointNeg(b *testing.B)     { benchP256.PointNeg(b.N) }
func BenchmarkPointMul(b *testing.B)     { benchP256.PointMul(b.N) }
开发者ID:LegoShrimp,项目名称:crypto,代码行数:31,代码来源:group_test.go

示例7: TestCompareBasicProjective41417

func TestCompareBasicProjective41417(t *testing.T) {
	if testing.Short() {
		t.Skip("skipping test in short mode.")
	} else {
		test.TestCompareGroups(testSuite,
			new(BasicCurve).Init(Param41417(), false),
			new(ProjectiveCurve).Init(Param41417(), false))
	}
}

func TestCompareBasicProjectiveE521(t *testing.T) {
	if testing.Short() {
		t.Skip("skipping test in short mode.")
	} else {
		test.TestCompareGroups(testSuite,
			new(BasicCurve).Init(ParamE521(), false),
			new(ProjectiveCurve).Init(ParamE521(), false))
	}
}

// Benchmark contrasting implementations of the Ed25519 curve

var basicBench = test.NewGroupBench(new(BasicCurve).Init(Param25519(), false))

func BenchmarkPointAddBasic(b *testing.B)     { basicBench.PointAdd(b.N) }
func BenchmarkPointMulBasic(b *testing.B)     { basicBench.PointMul(b.N) }
func BenchmarkPointBaseMulBasic(b *testing.B) { basicBench.PointBaseMul(b.N) }
func BenchmarkPointEncodeBasic(b *testing.B)  { basicBench.PointEncode(b.N) }
func BenchmarkPointDecodeBasic(b *testing.B)  { basicBench.PointDecode(b.N) }
func BenchmarkPointPickBasic(b *testing.B)    { basicBench.PointPick(b.N) }
开发者ID:LegoShrimp,项目名称:crypto,代码行数:30,代码来源:basic_test.go

示例8: BenchmarkSecretDecode

func BenchmarkSecretDecode(b *testing.B) {
	test.NewGroupBench(testSuite).SecretDecode(b.N)
}
开发者ID:Liamsi,项目名称:crypto,代码行数:3,代码来源:curve_test.go


注:本文中的github.com/dedis/crypto/test.NewGroupBench函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。