Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken docs #185

Merged
merged 3 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions benches/curve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@
use criterion::{black_box, criterion_group, criterion_main, Criterion, Throughput};
use ff::Field;
use group::prime::PrimeCurveAffine;
use halo2curves::bn256::G1;
use halo2curves::{bn256::G1, CurveExt};
use rand::SeedableRng;
use rand_xorshift::XorShiftRng;

use halo2curves::CurveExt;

fn bench_curve_ops<G: CurveExt>(c: &mut Criterion, name: &'static str) {
{
let mut rng = XorShiftRng::seed_from_u64(3141519u64);
Expand Down
3 changes: 1 addition & 2 deletions benches/hash_to_curve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
use std::iter;

use criterion::{black_box, criterion_group, criterion_main, Criterion, Throughput};
use halo2curves::bn256::G1;
use halo2curves::CurveExt;
use halo2curves::{bn256::G1, CurveExt};
use rand::SeedableRng;
use rand_core::RngCore;
use rand_xorshift::XorShiftRng;
Expand Down
6 changes: 3 additions & 3 deletions src/bn256/fq12.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ use crate::ff_ext::{
ExtField,
};

/// -GAMMA is a quadratic non-residue in Fp6. Fp12 = Fp6[X]/(X^2 + GAMMA)
/// We introduce the variable w such that w^2 = -GAMMA
// GAMMA = - v
// -GAMMA is a quadratic non-residue in Fp6. Fp12 = Fp6[X] / (X^2 + GAMMA)
// We introduce the variable w such that w^2 = -GAMMA
// GAMMA = -v
/// An element of Fq12, represented by c0 + c1 * w.
pub type Fq12 = QuadExtField<Fq6>;

Expand Down
1 change: 1 addition & 0 deletions src/curve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ pub trait CurveExt:
/// distributed elements in the group, given domain prefix `domain_prefix`.
///
/// This method is suitable for use as a random oracle.
#[allow(clippy::type_complexity)]
fn hash_to_curve<'a>(domain_prefix: &'a str) -> Box<dyn Fn(&[u8]) -> Self + 'a>;

/// Returns whether or not this element is on the curve; should
Expand Down
6 changes: 3 additions & 3 deletions src/ff_ext/inverse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,9 @@ impl<const B: usize, const L: usize> Mul<CInt<B, L>> for i64 {
/// recommended:
/// - D. Bernstein, B.-Y. Yang, "Fast constant-time gcd computation and modular
/// inversion",
/// https://gcd.cr.yp.to/safegcd-20190413.pdf
/// <https://gcd.cr.yp.to/safegcd-20190413.pdf>
/// - P. Wuille, "The safegcd implementation in libsecp256k1 explained",
/// https://github.com/bitcoin-core/secp256k1/blob/master/doc/safegcd_implementation.md
/// <https://github.com/bitcoin-core/secp256k1/blob/master/doc/safegcd_implementation.md>
pub struct BYInverter<const L: usize> {
/// Modulus
modulus: CInt<62, L>,
Expand Down Expand Up @@ -395,7 +395,7 @@ impl<const L: usize> BYInverter<L> {
/// multiplicative inverse modulo a power of two. For better
/// understanding the implementation, the following paper is recommended:
/// J. Hurchalla, "An Improved Integer Multiplicative Inverse (modulo 2^w)",
/// https://arxiv.org/pdf/2204.04342.pdf
/// <https://arxiv.org/pdf/2204.04342.pdf>
const fn inv(value: u64) -> i64 {
let x = value.wrapping_mul(3) ^ 2;
let y = 1u64.wrapping_sub(x.wrapping_mul(value));
Expand Down
6 changes: 3 additions & 3 deletions src/ff_ext/jacobi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl<const L: usize> LInt<L> {
#[inline]
fn sum(first: u64, second: u64, carry: bool) -> (u64, bool) {
// The implementation is inspired with the "carrying_add" function from this
// source: https://github.com/rust-lang/rust/blob/master/library/core/src/num/uint_macros.rs
// source: <https://github.com/rust-lang/rust/blob/master/library/core/src/num/uint_macros.rs>
let (second, carry) = second.overflowing_add(carry as u64);
let (first, high) = first.overflowing_add(second);
(first, carry || high)
Expand Down Expand Up @@ -330,9 +330,9 @@ fn jacobinary(mut n: u64, mut d: u64, mut t: u64) -> i64 {
/// differences have been commented; the aforesaid Pornin's method and the used
/// ideas of M. Hamburg were given here:
/// - T. Pornin, "Optimized Binary GCD for Modular Inversion",
/// https://eprint.iacr.org/2020/972.pdf
/// <https://eprint.iacr.org/2020/972.pdf>
/// - M. Hamburg, "Computing the Jacobi symbol using Bernstein-Yang",
/// https://eprint.iacr.org/2021/1271.pdf
/// <https://eprint.iacr.org/2021/1271.pdf>
pub fn jacobi<const L: usize>(n: &[u64], d: &[u64]) -> i64 {
// Instead of the variable "j" taking the values from {-1, 1} and satisfying
// at the end of the outer loop iteration the equation J = "j" * ("n" / |"d"|)
Expand Down
7 changes: 4 additions & 3 deletions src/pluto_eris/fp12.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ use crate::ff_ext::{
ExtField,
};

/// -GAMMA is a quadratic non-residue in Fp6. Fp12 = Fp6[X]/(X^2 + GAMMA)
/// We introduce the variable w such that w^2 = -GAMMA
/// GAMMA = - v
// -GAMMA is a quadratic non-residue in Fp6. Fp12 = Fp6[X]/(X^2 + GAMMA)
// We introduce the variable w such that w^2 = -GAMMA
// GAMMA = - v
/// An element of Fp12, represented by c0 + c1 * v.
pub type Fp12 = QuadExtField<Fp6>;

impl QuadExtFieldArith for Fp12 {
Expand Down
6 changes: 3 additions & 3 deletions src/pluto_eris/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
//! Implementation of the Pluto / Eris half-pairing cycle of prime order
//! elliptic curves.
//!
//! Supporting evidence: https://github.com/daira/pluto-eris
//! Field constant derivation: https://github.com/davidnevadoc/ec-constants/tree/main/pluto_eris
//! Pairing constants derivation: https://github.com/John-Gong-Math/pluto_eris/blob/main/pluto_pairing.ipynb
//! Supporting evidence: <https://github.com/daira/pluto-eris>
//! Field constant derivation: <https://github.com/davidnevadoc/ec-constants/tree/main/pluto_eris>
//! Pairing constants derivation: <https://github.com/John-Gong-Math/pluto_eris/blob/main/pluto_pairing.ipynb>
mod curve;
mod engine;
mod fp;
Expand Down
Loading