Crates.io | halo2curves-axiom |
lib.rs | halo2curves-axiom |
version | 0.7.0 |
source | src |
created_at | 2023-11-15 22:09:52.939219 |
updated_at | 2024-08-13 22:01:48.910977 |
description | Elliptic curve implementations and wrappers for halo2 library. This is a fork of the "halo2curves" crate for Axiom's production usage. |
homepage | |
repository | https://github.com/axiom-crypto/halo2curves |
max_upload_size | |
id | 1036914 |
size | 6,990,328 |
This library provides efficient and flexible implementations of various halo2-friendly elliptic curves, originally implementing the BN256 curve with traits from the zkcrypto
ecosystem,
The implementations were originally ported from matterlabs/pairing and zkcrypto/bls12-381, but have been extended and optimized to cover a broader set of curves and use cases. Since its initial release, the library has expanded to include additional curves, along with the following features:
secp256k1
, secp256r1
, and grumpkin
curves, enhancing its usability across a range of cryptographic protocols.halo2curves
currently uses rayon for parallel
computation.
The RAYON_NUM_THREADS
environment variable can be used to set the number of
threads.
When compiling to WASM-targets, notice that since version 1.7
, rayon
will fallback automatically (with no need to handle features) to require getrandom
in order to be able to work.
For more info related to WASM-compilation.
See: Rayon: Usage with WebAssembly for more info.
Benchmarking is supported through the use of Rust's built-in test framework. Benchmarks can be run without assembly optimizations:
$ cargo test --profile bench test_field -- --nocapture
or with assembly optimizations:
$ cargo test --profile bench test_field --features asm -- --nocapture
Derivation of Serialize/Deserialize: The library supports Serde's Serialize
and Deserialize
traits for field and group elements, making it easier to integrate curve operations into serialization-dependent workflows.
Hash to Curve: For the bn256::G1
and grumpkin::G1
curves, hash_to_curve
is implemented, enabling more efficient hash-and-sign signature schemes.
Lookup Table: A pre-computed lookup table is available for bn256::Fr
, accelerating conversion from u16
to montgomery representation.
The library's top-level directories are organized as follows:
benches
: Contains benchmarking tests.script
: Contains utility scripts.src
: Contains the source code of the library, further subdivided into modules for each supported curve (bn256
, grumpkin
, secp256k1
, secp256r1
, pasta
) and additional functionalities (derive
, tests
).