當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。