use curv::elliptic::curves::*;
use sha2::Sha256;
pub fn dlog_proof<E: Curve>() {
use curv::cryptographic_primitives::proofs::sigma_dlog::*;
let witness = Scalar::random();
let dlog_proof = DLogProof::<E, Sha256>::prove(&witness);
assert!(DLogProof::verify(&dlog_proof).is_ok());
}
fn main() {
let curve_name = std::env::args().nth(1);
match curve_name.as_deref() {
Some("secp256k1") => dlog_proof::<Secp256k1>(),
Some("ristretto") => dlog_proof::<Ristretto>(),
Some("ed25519") => dlog_proof::<Ed25519>(),
Some("bls12_381_1") => dlog_proof::<Bls12_381_1>(),
Some("bls12_381_2") => dlog_proof::<Bls12_381_2>(),
Some("p256") => dlog_proof::<Secp256r1>(),
Some(unknown_curve) => eprintln!("Unknown curve: {}", unknown_curve),
None => eprintln!("Missing curve name"),
}
}