gurvy

package module
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2021 License: Apache-2.0 Imports: 0 Imported by: 0

README

gurvy

License Go Report Card PkgGoDev

gurvy implements Elliptic Curve Cryptography (+Pairing) for BLS381, BLS377 and BN256.

It is actively developed and maintained by the team (zkteam@consensys.net) behind:

Warning

gurvy has not been audited and is provided as-is, use at your own risk. In particular, gurvy makes no security guarantees such as constant time implementation or side-channel attack resistance.

gurvy is optimized for 64bits architectures (x86 amd64) and tested on Unix (Linux / macOS).

Curves supported

  • BLS12-381 (Zcash)
  • BN256 (Ethereum)
  • BLS377 (ZEXE)
  • BW6-761 (EC supporting pairing on BLS377 field of definition)

Getting started

Go version

gurvy is tested with the last 2 major releases of Go (1.14 and 1.15).

Install gurvy
go get github.com/consensys/gurvy

Note if that if you use go modules, in go.mod the module path is case sensitive (use consensys and not ConsenSys).

Documentation

PkgGoDev

The APIs are consistent accross the curves. For example, here is bn256 godoc.

Benchmarks

Here are our measurements comparing gurvy (and goff our finite field library) with mcl.

These benchmarks ran on a AWS z1d.3xlarge instance, with hyperthreading disabled.

bn256 mcl(ns/op) gurvy & goff (ns/op)
Fp::Add 3.32 3.44
Fp::Mul 18.43 16.1
Fp::Square 18.64 15.1
Fp::Inv 690.55 2080*
Fp::Pow 6485 7440*
G1::ScalarMul 41394 56900
G1::Add 213 224
G1::Double 155 178
G2::ScalarMul 88423 141000
G2::Add 598 871
G2::Double 371 386
Pairing 478244 489258

bls381 mcl(ns/op) gurvy & goff (ns/op)
Fp::Add 5.42 4.6
Fp::Mul 33.63 29.3
Fp::Square 33.86 27
Fp::Inv 1536 4390*
Fp::Pow 18039 18300*
G1::ScalarMul 76799 91500
G1::Add 424 389
G1::Double 308 301
G2::ScalarMul 159068 273000
G2::Add 1162 1240
G2::Double 727 799
Pairing 676513 707984

*note that some routines don't have assembly implementation in goff yet.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

License

This project is licensed under the Apache 2 License - see the LICENSE file for details

Documentation

Overview

Package gurvy is an elliptic curve (+pairing) library. It currently expose efficient implementations for bls381, bls377, bn256 and bw761

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ID

type ID uint16

ID represent a unique ID for a curve

const (
	UNKNOWN ID = iota
	BLS377
	BLS381
	BN256
	BW761
)

do not modify the order of this enum

func (ID) String

func (id ID) String() string

Directories

Path Synopsis
Package bls377 provides efficient elliptic curve and pairing implementation for bls377
Package bls377 provides efficient elliptic curve and pairing implementation for bls377
fp
Package fp contains field arithmetic operations for modulus 258664426012969094010652733694893533536393512754914660539884262666720468348340822774968888139573360124440321458177
Package fp contains field arithmetic operations for modulus 258664426012969094010652733694893533536393512754914660539884262666720468348340822774968888139573360124440321458177
fr
Package fr contains field arithmetic operations for modulus 8444461749428370424248824938781546531375899335154063827935233455917409239041
Package fr contains field arithmetic operations for modulus 8444461749428370424248824938781546531375899335154063827935233455917409239041
Package bls381 provides efficient elliptic curve and pairing implementation for bls381
Package bls381 provides efficient elliptic curve and pairing implementation for bls381
fp
Package fp contains field arithmetic operations for modulus 4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559787
Package fp contains field arithmetic operations for modulus 4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559787
fr
Package fr contains field arithmetic operations for modulus 52435875175126190479447740508185965837690552500527637822603658699938581184513
Package fr contains field arithmetic operations for modulus 52435875175126190479447740508185965837690552500527637822603658699938581184513
Package bn256 provides efficient elliptic curve and pairing implementation for bn256
Package bn256 provides efficient elliptic curve and pairing implementation for bn256
fp
Package fp contains field arithmetic operations for modulus 21888242871839275222246405745257275088696311157297823662689037894645226208583
Package fp contains field arithmetic operations for modulus 21888242871839275222246405745257275088696311157297823662689037894645226208583
fr
Package fr contains field arithmetic operations for modulus 21888242871839275222246405745257275088548364400416034343698204186575808495617
Package fr contains field arithmetic operations for modulus 21888242871839275222246405745257275088548364400416034343698204186575808495617
Package bw761 provides efficient elliptic curve and pairing implementation for bw761
Package bw761 provides efficient elliptic curve and pairing implementation for bw761
fp
Package fp contains field arithmetic operations for modulus 6891450384315732539396789682275657542479668912536150109513790160209623422243491736087683183289411687640864567753786613451161759120554247759349511699125301598951605099378508850372543631423596795951899700429969112842764913119068299
Package fp contains field arithmetic operations for modulus 6891450384315732539396789682275657542479668912536150109513790160209623422243491736087683183289411687640864567753786613451161759120554247759349511699125301598951605099378508850372543631423596795951899700429969112842764913119068299
fr
Package fr contains field arithmetic operations for modulus 258664426012969094010652733694893533536393512754914660539884262666720468348340822774968888139573360124440321458177
Package fr contains field arithmetic operations for modulus 258664426012969094010652733694893533536393512754914660539884262666720468348340822774968888139573360124440321458177

Jump to

Keyboard shortcuts

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