• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.chglog/H26-Apr-2021-7772

.circleci/H26-Apr-2021-2928

.github/workflows/H26-Apr-2021-105103

accumulator/merkletree/H26-Apr-2021-589230

ecc/H26-Apr-2021-104,14771,334

fiat-shamir/H26-Apr-2021-300176

field/H26-Apr-2021-4,2082,940

hash/H26-Apr-2021-8352

internal/H26-Apr-2021-9,4627,605

polynomial/H26-Apr-2021-8236

signature/H26-Apr-2021-10033

.gitignoreH A D26-Apr-2021464 3730

.gitlintH A D26-Apr-2021431 129

CHANGELOG.mdH A D26-Apr-20211.9 KiB6146

CODE_OF_CONDUCT.mdH A D26-Apr-20213.2 KiB7355

CONTRIBUTING.mdH A D26-Apr-20213.2 KiB6753

LICENSEH A D26-Apr-202111.1 KiB202169

README.mdH A D26-Apr-20213.4 KiB7341

go.modH A D26-Apr-2021362 1310

go.sumH A D26-Apr-20215.1 KiB5352

README.md

1# gnark-crypto
2
3[![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)
4
5`gnark-crypto` provides:
6* [Elliptic curve cryptography](ecc/ecc.md) (+pairing) on BN254, BLS12-381, BLS12-377 and BW6-761
7* [Finite field arithmetic](field/field.md) (fast big.Int)
8* FFT
9* Polynomial commitment schemes
10* MiMC
11* EdDSA (on the "companion" twisted edwards curves)
12
13
14
15`gnark-crypto` is actively developed and maintained by the team (zkteam@consensys.net | [HackMD](https://hackmd.io/@zkteam)) behind:
16* [`gnark`: a framework to execute (and verify) algorithms in zero-knowledge](https://github.com/consensys/gnark)
17
18
19## Warning
20**`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.**
21
22`gnark-crypto` packages are optimized for 64bits architectures (x86 `amd64`) and tested on Unix (Linux / macOS).
23
24
25## Getting started
26
27### Go version
28
29`gnark-crypto` is tested with the last 2 major releases of Go (1.15 and 1.16).
30
31### Install `gnark-crypto`
32
33```bash
34go get github.com/consensys/gnark-crypto
35```
36
37Note if that if you use go modules, in `go.mod` the module path is case sensitive (use `consensys` and not `ConsenSys`).
38
39### Documentation
40
41[![PkgGoDev](https://pkg.go.dev/badge/mod/github.com/consensys/gnark-crypto)](https://pkg.go.dev/mod/github.com/consensys/gnark-crypto)
42
43The 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).
44
45### Development
46
47Most (but not all) of the code is generated from the templates in `internal/generator`.
48
49The 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:
50
511. 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.
522. No generics in Go: need to derive (mostly) identical code for various moduli and curves, with consistent APIs
53
54To regenerate the files, see `internal/generator/main.go`. Run:
55```
56go generate ./internal/...
57```
58
59## Benchmarks
60
61[Benchmarking pairing-friendly elliptic curves libraries](https://hackmd.io/@zkteam/eccbench)
62
63>The libraries are implemented in different languages and some use more assembly code than others. Besides the different algorithmic and software optimizations used across, it should be noted also that some libraries target constant-time implementation for some operations making it de facto slower. However, it can be clear that consensys/gnark-crypto is one of the fastest pairing-friendly elliptic curve libraries to be used in zkp projects with different curves.
64
65## Versioning
66
67We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/consensys/gnark-crypto/tags).
68
69
70## License
71
72This project is licensed under the Apache 2 License - see the [LICENSE](LICENSE) file for details
73