package
0.0.0-20221019060107-edb949a317e9
Repository: https://github.com/hellobchain/newcryptosm.git
Documentation: pkg.go.dev

# README

bn256

Package sm9 implements a particular bilinear group at the 128-bit security level. It is a modification of the official version at https://golang.org/x/crypto/bn256 but all operations are ~10 times faster on amd64 and arm64. There is a lattices branch for non-commercial use where non-pairing operations are up to ~20 times faster.

Bilinear groups are the basis of many of the new cryptographic protocols that have been proposed over the past decade. They consist of a triplet of groups (G₁, G₂ and GT) such that there exists a function e(g₁ˣ,g₂ʸ)=gTˣʸ (where gₓ is a generator of the respective group). That function is called a pairing function.

This package specifically implements the Optimal Ate pairing over a 256-bit Barreto-Naehrig curve as described in http://cryptojedi.org/papers/dclxvi-20100714.pdf. Its output is compatible with the implementation described in that paper.

Benchmarks

branch master:

BenchmarkG1-4        	   10000	    154995 ns/op
BenchmarkG2-4        	    3000	    541503 ns/op
BenchmarkGT-4        	    1000	   1267811 ns/op
BenchmarkPairing-4   	    1000	   1630584 ns/op

branch lattices:

BenchmarkG1-4        	   20000	     92198 ns/op
BenchmarkG2-4        	    5000	    340622 ns/op
BenchmarkGT-4        	    2000	    635061 ns/op
BenchmarkPairing-4   	    1000	   1629943 ns/op

official version:

BenchmarkG1-4        	    1000	   2268491 ns/op
BenchmarkG2-4        	     300	   7227637 ns/op
BenchmarkGT-4        	     100	  15121359 ns/op
BenchmarkPairing-4   	      50	  20296164 ns/op

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Compress compress a point to a byte string.
No description provided by the author
Decompress decompress a byte string to a point.
decompressPoint decompresses a point on the given curve given the X point and the solution to use.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Miller applies Miller's algorithm, which is a bilinear function from the source groups to F_p^12.
No description provided by the author
func montEncode(c, a *gfP) { gfpMul(c, a, r2) }.
No description provided by the author
No description provided by the author
No description provided by the author
Pair calculates an Optimal Ate pairing.
No description provided by the author
No description provided by the author
RandomG1 returns x and g₁ˣ where x is a random, non-zero number read from r.
RandomG2 returns x and g₂ˣ where x is a random, non-zero number read from r.
RandomGT returns x and e(g₁, g₂)ˣ where x is a random, non-zero number read from r.
SM9 return the elliptic.Curve interface of SM9 curve.

# Variables

No description provided by the author
need mogo format //somin 1023change and check;var G1x = &gfP{0xe8c4e4817c66dddd, 0xe1e4086909dc3280, 0xf5ed0704487d01d6, 0x93de051d62bf718f}.
No description provided by the author
Order is the number of elements in both G₁ and G₂: 36u⁴+36u³+18u²+6u+1.
checked.

# Structs

No description provided by the author
G1 is an abstract cyclic group.
G2 is an abstract cyclic group.
GT is an abstract cyclic group.