[−][src]Module mcl::bn
Module implementing the high level structures for manipulating MCL points and scalars.
Examples
// Schnorr identification scheme. // Prover wants to show to the Verifier that he knows the secret key, use mcl::{init, bn::{Fr, G1}}; // Always initialize the library first. init::init_curve(init::Curve::Bls12_381); // choose the generators for both of the groups let g = G1::hash_and_map(b"something").unwrap(); // setup the keys let sk = Fr::from_csprng(); let pk = &g * &sk; // initialize ephemerals (done by the Prover) let x = Fr::from_csprng(); let commitment = &g * &x; // generate challenge (done by the Verifier) let c = Fr::from_csprng(); // compute the response (done by the Prover) let s = x + &sk * &c; // verify the proof (done by the Verifier) assert_eq!(&g * s, &commitment + pk * &c);
Structs
Fp | |
Fp2 | |
Fr | |
G1 | |
G2 | |
GT |