-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #237 from ConsenSys/develop
v0.8.0
- Loading branch information
Showing
275 changed files
with
10,586 additions
and
3,845 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,19 +2,33 @@ | |
|
||
[![Twitter URL](https://img.shields.io/twitter/url/https/twitter.com/gnark_team.svg?style=social&label=Follow%20%40gnark_team)](https://twitter.com/gnark_team) [![License](https://img.shields.io/badge/license-Apache%202-blue)](LICENSE) [![Go Report Card](https://goreportcard.com/badge/github.com/ConsenSys/gnark-crypto)](https://goreportcard.com/badge/github.com/ConsenSys/gnark-crypto) [![PkgGoDev](https://pkg.go.dev/badge/mod/github.com/consensys/gnark-crypto)](https://pkg.go.dev/mod/github.com/consensys/gnark-crypto) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.5815453.svg)](https://doi.org/10.5281/zenodo.5815453) | ||
|
||
`gnark-crypto` provides: | ||
* [Elliptic curve cryptography](ecc/ecc.md) (+pairing) on BN254, BLS12-381, BLS12-377, BW6-761, BLS24-315, BLS24-317, BW6-633, BLS12-378 and BW6-756 | ||
* [Finite field arithmetic](field/field.md) (fast big.Int) | ||
* FFT | ||
* Polynomial commitment schemes | ||
* MiMC | ||
* EdDSA (on the "companion" twisted edwards curves) | ||
`gnark-crypto` provides efficient cryptographic primitives, in Go: | ||
|
||
* Elliptic curve cryptography & **Pairing** on: | ||
* [`bn254`] ([audit report]()) | ||
* [`bls12-381`] ([audit report]()) | ||
* [`bls24-317`] | ||
* [`bls12-377`] / [`bw6-761`] | ||
* [`bls24-315`] / [`bw6-633`] | ||
* [`bls12-378`] / [`bw6-756`] | ||
* Each of these curve has a [`twistededwards`] sub-package with its companion curve which allow efficient elliptic curve cryptography inside zkSNARK circuits. | ||
* [`field/goff`] - Finite field arithmetic code generator (blazingly fast big.Int) | ||
* [`fft`] - Fast Fourier Transform | ||
* [`fri`] - FRI (multiplicative) commitment scheme | ||
* [`fiatshamir`] - Fiat-Shamir transcript builder | ||
* [`mimc`] - MiMC hash function using Miyaguchi-Preneel construction | ||
* [`kzg`] - KZG commitment scheme | ||
* [`permutation`] - Permutation proofs | ||
* [`plookup`] - Plookup proofs | ||
* [`eddsa`] - EdDSA signatures (on the companion [`twistededwards`] curves) | ||
|
||
`gnark-crypto` is actively developed and maintained by the team ([email protected] | [HackMD](https://hackmd.io/@gnark)) behind: | ||
* [`gnark`: a framework to execute (and verify) algorithms in zero-knowledge](https://github.com/consensys/gnark) | ||
|
||
* [`gnark`: a framework to execute (and verify) algorithms in zero-knowledge](https://github.com/consensys/gnark) | ||
|
||
## Warning | ||
**`gnark-crypto` has not been audited and is provided as-is, use at your own risk. In particular, `gnark-crypto` makes no security guarantees such as constant time implementation or side-channel attack resistance.** | ||
|
||
**`gnark-crypto` is not fully audited and is provided as-is, use at your own risk. In particular, `gnark-crypto` makes no security guarantees such as constant time implementation or side-channel attack resistance.** | ||
|
||
**To report a security bug, please refer to [`gnark` Security Policy](https://github.com/ConsenSys/gnark/blob/master/SECURITY.md).** | ||
|
||
|
@@ -24,7 +38,7 @@ | |
|
||
### Go version | ||
|
||
`gnark-crypto` is tested with the last 2 major releases of Go (1.16 and 1.17). | ||
`gnark-crypto` is tested with the last 2 major releases of Go (1.17 and 1.18). | ||
|
||
### Install `gnark-crypto` | ||
|
||
|
@@ -34,24 +48,19 @@ go get github.com/consensys/gnark-crypto | |
|
||
Note if that if you use go modules, in `go.mod` the module path is case sensitive (use `consensys` and not `ConsenSys`). | ||
|
||
### Documentation | ||
|
||
[![PkgGoDev](https://pkg.go.dev/badge/mod/github.com/consensys/gnark-crypto)](https://pkg.go.dev/mod/github.com/consensys/gnark-crypto) | ||
|
||
The APIs are consistent accross the curves. For example, [here is `bn254` godoc](https://pkg.go.dev/github.com/consensys/gnark-crypto/ecc/bn254#pkg-overview). | ||
|
||
### Development | ||
|
||
Most (but not all) of the code is generated from the templates in `internal/generator`. | ||
|
||
The generated code contains little to no interfaces and is strongly typed with a base field (generated by the `gnark-crypto/field`). The two main factors driving this design choice are: | ||
The generated code contains little to no interfaces and is strongly typed with a field (generated by the `gnark-crypto/field` package). The two main factors driving this design choice are: | ||
|
||
1. Performance: `gnark-crypto` algorithms manipulates millions (if not billions) of field elements. Interface indirection at this level, plus garbage collection indexing takes a heavy toll on perf. | ||
2. No generics in Go: need to derive (mostly) identical code for various moduli and curves, with consistent APIs | ||
2. Need to derive (mostly) identical code for various moduli and curves, with consistent APIs. Generics introduce significant performance overhead and are not yet suited for high performance computing. | ||
|
||
To regenerate the files, see `internal/generator/main.go`. Run: | ||
``` | ||
go generate ./internal/... | ||
|
||
```bash | ||
go generate ./... | ||
``` | ||
|
||
## Benchmarks | ||
|
@@ -86,7 +95,26 @@ Please use the following BibTeX to cite the most recent release. | |
|
||
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/consensys/gnark-crypto/tags). | ||
|
||
|
||
## License | ||
|
||
This project is licensed under the Apache 2 License - see the [LICENSE](LICENSE) file for details | ||
This project is licensed under the Apache 2 License - see the [LICENSE](LICENSE) file for details. | ||
|
||
[`field/goff`]: https://pkg.go.dev/github.com/consensys/gnark-crypto/field/goff | ||
[`bn254`]: https://pkg.go.dev/github.com/consensys/gnark-crypto/ecc/bn254 | ||
[`bls12-381`]: https://pkg.go.dev/github.com/consensys/gnark-crypto/ecc/bls12-381 | ||
[`bls24-317`]: https://pkg.go.dev/github.com/consensys/gnark-crypto/ecc/bls24-317 | ||
[`bls12-377`]: https://pkg.go.dev/github.com/consensys/gnark-crypto/ecc/bls12-377 | ||
[`bls24-315`]: https://pkg.go.dev/github.com/consensys/gnark-crypto/ecc/bls24-315 | ||
[`bls12-378`]: https://pkg.go.dev/github.com/consensys/gnark-crypto/ecc/bls12-378 | ||
[`bw6-761`]: https://pkg.go.dev/github.com/consensys/gnark-crypto/ecc/bw6-761 | ||
[`bw6-633`]: https://pkg.go.dev/github.com/consensys/gnark-crypto/ecc/bw6-633 | ||
[`bw6-756`]: https://pkg.go.dev/github.com/consensys/gnark-crypto/ecc/bw6-756 | ||
[`twistededwards`]: https://pkg.go.dev/github.com/consensys/gnark-crypto/ecc/bn254/twistededwards | ||
[`eddsa`]: https://pkg.go.dev/github.com/consensys/gnark-crypto/ecc/bn254/twistededwards/eddsa | ||
[`fft`]: https://pkg.go.dev/github.com/consensys/gnark-crypto/ecc/bn254/fr/fft | ||
[`fri`]: https://pkg.go.dev/github.com/consensys/gnark-crypto/ecc/bn254/fr/fri | ||
[`mimc`]: https://pkg.go.dev/github.com/consensys/gnark-crypto/ecc/bn254/fr/mimc | ||
[`kzg`]: https://pkg.go.dev/github.com/consensys/gnark-crypto/ecc/bn254/fr/kzg | ||
[`plookup`]: https://pkg.go.dev/github.com/consensys/gnark-crypto/ecc/bn254/fr/plookup | ||
[`permutation`]: https://pkg.go.dev/github.com/consensys/gnark-crypto/ecc/bn254/fr/permutation | ||
[`fiatshamir`]: https://pkg.go.dev/github.com/consensys/gnark-crypto/fiat-shamir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.