github.com/hellobchain/newcryptosm@v0.0.0-20221019060107-edb949a317e9/sm9/README.md (about)

     1  bn256
     2  -----
     3  
     4  Package sm9 implements a particular bilinear group at the 128-bit security
     5  level. It is a modification of the official version at
     6  https://golang.org/x/crypto/bn256 but all operations are ~10 times faster on
     7  amd64 and arm64. There is a `lattices` branch for non-commercial use where
     8  non-pairing operations are up to ~20 times faster.
     9  
    10  Bilinear groups are the basis of many of the new cryptographic protocols that
    11  have been proposed over the past decade. They consist of a triplet of groups
    12  (G₁, G₂ and GT) such that there exists a function e(g₁ˣ,g₂ʸ)=gTˣʸ (where gₓ is a
    13  generator of the respective group). That function is called a pairing function.
    14  
    15  This package specifically implements the Optimal Ate pairing over a 256-bit
    16  Barreto-Naehrig curve as described in
    17  http://cryptojedi.org/papers/dclxvi-20100714.pdf. Its output is compatible with
    18  the implementation described in that paper.
    19  
    20  ### Benchmarks
    21  
    22  branch `master`:
    23  ```
    24  BenchmarkG1-4        	   10000	    154995 ns/op
    25  BenchmarkG2-4        	    3000	    541503 ns/op
    26  BenchmarkGT-4        	    1000	   1267811 ns/op
    27  BenchmarkPairing-4   	    1000	   1630584 ns/op
    28  ```
    29  
    30  branch `lattices`:
    31  ```
    32  BenchmarkG1-4        	   20000	     92198 ns/op
    33  BenchmarkG2-4        	    5000	    340622 ns/op
    34  BenchmarkGT-4        	    2000	    635061 ns/op
    35  BenchmarkPairing-4   	    1000	   1629943 ns/op
    36  ```
    37  
    38  official version:
    39  ```
    40  BenchmarkG1-4        	    1000	   2268491 ns/op
    41  BenchmarkG2-4        	     300	   7227637 ns/op
    42  BenchmarkGT-4        	     100	  15121359 ns/op
    43  BenchmarkPairing-4   	      50	  20296164 ns/op
    44  ```