MCPcopy Create free account
hub / github.com/docknetwork/crypto / check

Function check

utils/src/elgamal.rs:301–308  ·  view source on GitHub ↗
(rng: &mut StdRng)

Source from the content-addressed store, hash-verified

299 let mut rng = StdRng::seed_from_u64(0u64);
300
301 fn check<G: AffineRepr>(rng: &mut StdRng) {
302 let g = G::Group::rand(rng).into_affine();
303 let (sk, pk) = keygen(rng, &g);
304
305 let msg = G::Group::rand(rng).into_affine();
306 let (ciphertext, _) = Ciphertext::new(rng, &msg, &pk.0, &g);
307 assert_eq!(ciphertext.decrypt(&sk.0), msg);
308 }
309
310 check::<G1Affine>(&mut rng);
311 check::<G2Affine>(&mut rng);

Callers

nothing calls this directly

Calls 3

randFunction · 0.85
mapMethod · 0.80
keygenFunction · 0.70

Tested by

no test coverage detected