mirror of
https://github.com/status-im/nim-bncurve.git
synced 2025-02-19 16:34:24 +00:00
* prefer stew/staticfor * cleanup pragmas * unroll a few more things These simplifications also bring a nice little 10-15% perf boost: ``` arnetheduck@praeceps:~/status/nimbus-eth1/vendor/nim-bncurve$ /home/arnetheduck/status/nimbus-eth1/vendor/nim-bncurve/benchmarks/bench G1 Jacobian add: 578 ns G1 toAffine: 3067 ns G2 Jacobian add: 3141 ns G2 toAffine: 3772 ns G1 Jacobian mul: 191442 ns G2 Jacobian mul: 819047 ns Pairing: 2111668 ns arnetheduck@praeceps:~/status/nimbus-eth1/vendor/nim-bncurve$ /home/arnetheduck/status/nimbus-eth1/vendor/nim-bncurve/benchmarks/bench G1 Jacobian add: 497 ns G1 toAffine: 2774 ns G2 Jacobian add: 2701 ns G2 toAffine: 3461 ns G1 Jacobian mul: 147267 ns G2 Jacobian mul: 633992 ns Pairing: 1816686 ns ```
BNCurve
Introduction
This pure Nim implementation of Barreto-Naehrig pairing-friendly elliptic curve.
This is a pairing cryptography library written in pure Nim. It makes use of the Barreto-Naehrig (BN) curve construction from [BCTV2015] to provide two cyclic groups G1 and G2, with an efficient bilinear pairing:
e: G1 × G2 → GT
This code is adaptation of bn library.
Security warnings
This library, like other pairing cryptography libraries implementing this construction, is not resistant to side-channel attacks.
Installation
Add to your .nimble
file:
requires "https://github.com/status-im/nim-bncurve"
or install it via
nimble install https://github.com/status-im/nim-bncurve
Build and test
nimble install https://github.com/status-im/nim-bncurve
nimble test
License
Licensed and distributed under either of
- MIT license: LICENSE-MIT or http://opensource.org/licenses/MIT
or
- Apache License, Version 2.0, (LICENSE-APACHEv2 or http://www.apache.org/licenses/LICENSE-2.0)
at your option. This file may not be copied, modified, or distributed except according to those terms.
Description
Languages
Nim
100%