7 unstable releases

0.5.0 Oct 28, 2024
0.5.0-alpha.0 Jun 20, 2024
0.4.0 Jan 17, 2023
0.4.0-alpha.2 Dec 28, 2022
0.2.0 Mar 25, 2021

#32 in #finite-fields

Download history 139090/week @ 2025-04-07 124445/week @ 2025-04-14 126426/week @ 2025-04-21 117293/week @ 2025-04-28 121374/week @ 2025-05-05 134629/week @ 2025-05-12 120863/week @ 2025-05-19 117786/week @ 2025-05-26 138394/week @ 2025-06-02 134278/week @ 2025-06-09 128906/week @ 2025-06-16 140774/week @ 2025-06-23 119756/week @ 2025-06-30 129225/week @ 2025-07-07 133328/week @ 2025-07-14 148537/week @ 2025-07-21

539,134 downloads per month
Used in 1,731 crates (109 directly)

MIT/Apache

620KB
13K SLoC

This library implements the BN254 curve that was sampled as part of the [BCTV14] paper . The name denotes that it is a Barreto--Naehrig curve of embedding degree 12, defined over a 254-bit (prime) field. The scalar field is highly 2-adic.

This curve is also implemented in libff under the name bn128. It is the same as the bn256 curve used in Ethereum (eg: go-ethereum).

#CAUTION This curve does not satisfy the 128-bit security level anymore.

Curve information:

  • Base field: q = 21888242871839275222246405745257275088696311157297823662689037894645226208583
  • Scalar field: r = 21888242871839275222246405745257275088548364400416034343698204186575808495617
  • valuation(q - 1, 2) = 1
  • valuation(r - 1, 2) = 28
  • G1 curve equation: y^2 = x^3 + 3
  • G2 curve equation: y^2 = x^3 + B, where
    • B = 3/(u+9) where Fq2 is represented as Fq[u]/(u^2+1) = Fq2(19485874751759354771024239261021720505790618469301721065564631296452457478373, 266929791119991161246907387137283842545076965332900288569378510910307636690)

Dependencies

~3.5–5MB
~94K SLoC