Skip to content
Snippets Groups Projects

add an example to print the Fq and Fr of all the Arkworks' curves

Merged STEVAN Antoine requested to merge print-all-curves into main
1 file
+ 46
0
Compare changes
  • Side-by-side
  • Inline
  • e6d90f66
    to generate the list of all curves to put in the macro
    ```nushell
    open Cargo.toml
        | get dev-dependencies
        | transpose k v
        | where k =~ "ark-" and k !~ "ark-poly"
        | get k
        | str replace --all '-' '_'
        | str join ",\n"
    ```
+ 46
0
use ark_ff::PrimeField;
fn show_curve<Fr: PrimeField, Fq: PrimeField>(name: &str) {
println!(
"{}: {} -> {}",
name,
Fq::MODULUS_BIT_SIZE,
Fr::MODULUS_BIT_SIZE
);
}
macro_rules! show_curve {
($($c:ident),+ $(,)?) => {
$(show_curve::<$c::Fr, $c::Fq>(stringify!($c));)*
}
}
fn main() {
show_curve!(
ark_bls12_377,
ark_bls12_381,
ark_bn254,
ark_bw6_761,
ark_cp6_782,
ark_curve25519,
ark_ed_on_bls12_377,
ark_ed_on_bls12_381,
ark_ed_on_bls12_381_bandersnatch,
ark_ed_on_bn254,
ark_ed_on_bw6_761,
ark_ed_on_cp6_782,
ark_ed_on_mnt4_298,
ark_ed_on_mnt4_753,
ark_ed25519,
ark_mnt4_298,
ark_mnt4_753,
ark_mnt6_298,
ark_mnt6_753,
ark_pallas,
ark_secp256k1,
ark_secp256r1,
ark_secp384r1,
ark_secq256k1,
ark_vesta,
);
}
Loading