fn prove_sharing(
    receiver_fs_public_keys: &[miracl::ECP],
    public_coefficients: &[miracl::ECP2],
    ciphertext: &crypto::Crsz,
    plaintext_chunks: &[Vec<isize>],
    toxic_waste: &crypto::ToxicWaste,
    rng: &mut crypto::RAND_ChaCha20,
) -> crypto::ProofSharing {
    // Convert fs encryption data:
    let combined_ciphertexts: Vec<miracl::ECP> = ciphertext
        .cc
        .iter()
        .map(util::ecp_from_big_endian_chunks)
        .collect();
    let combined_r_scalar: miracl::BIG = util::big_from_big_endian_chunks(&toxic_waste.spec_r);
    let combined_r = util::ecp_from_big_endian_chunks(&ciphertext.rr);
    let combined_plaintexts: Vec<miracl::BIG> = plaintext_chunks
        .iter()
        .map(|receiver_chunks| {
            util::big_from_big_endian_chunks(
                &receiver_chunks
                    .iter()
                    .copied()
                    .map(miracl::BIG::new_int)
                    .collect(),
            )
        })
        .collect();

    crypto::prove_sharing(
        &crypto::SharingInstance {
            g1_gen: miracl::ECP::generator(),
            g2_gen: miracl::ECP2::generator(),
            public_keys: receiver_fs_public_keys.to_vec(),
            public_coefficients: public_coefficients.to_vec(),
            combined_randomizer: combined_r,
            combined_ciphertexts,
        },
        &crypto::SharingWitness {
            scalar_r: combined_r_scalar,
            scalars_s: combined_plaintexts,
        },
        rng,
    )
}
/// Zero knowledge proof of correct sharing
Zero knowledge proof of correct sharing
Zero knowledge proof of correct sharing
fn prove_sharing(
    receiver_fs_public_keys: &[miracl::ECP],
    public_coefficients: &[miracl::ECP2],
    ciphertext: &crypto::Crsz,
    plaintext_chunks: &[Vec<isize>],
    toxic_waste: &crypto::ToxicWaste,
    rng: &mut crypto::RAND_ChaCha20,
) -> crypto::ProofSharing {
    // Convert fs encryption data:
    let combined_ciphertexts: Vec<miracl::ECP> = ciphertext
        .cc
        .iter()
        .map(util::ecp_from_big_endian_chunks)
        .collect();
    let combined_r_scalar: miracl::BIG = util::big_from_big_endian_chunks(&toxic_waste.spec_r);
    let combined_r = util::ecp_from_big_endian_chunks(&ciphertext.rr);
    let combined_plaintexts: Vec<miracl::BIG> = plaintext_chunks
        .iter()
        .map(|receiver_chunks| {
            util::big_from_big_endian_chunks(
                &receiver_chunks
                    .iter()
                    .copied()
                    .map(miracl::BIG::new_int)
                    .collect(),
            )
        })
        .collect();
    crypto::prove_sharing(
        &crypto::SharingInstance {
            g1_gen: miracl::ECP::generator(),
            g2_gen: miracl::ECP2::generator(),
            public_keys: receiver_fs_public_keys.to_vec(),
            public_coefficients: public_coefficients.to_vec(),
            combined_randomizer: combined_r,
            combined_ciphertexts,
        },
        &crypto::SharingWitness {
            scalar_r: combined_r_scalar,
            scalars_s: combined_plaintexts,
        },
        rng,
    )
}
fn prove_sharing ( receiver_fs_public_keys : & [ miracl :: ECP ] , public_coefficients : & [ miracl :: ECP2 ] , ciphertext : & crypto :: Crsz , plaintext_chunks : & [ Vec < isize > ] , toxic_waste : & crypto :: ToxicWaste , rng : & mut crypto :: RAND_ChaCha20 , ) -> crypto :: ProofSharing { // Convert fs encryption data: let combined_ciphertexts : Vec < miracl :: ECP > = ciphertext . cc . iter ( ) . map ( util :: ecp_from_big_endian_chunks ) . collect ( ) ; let combined_r_scalar : miracl :: BIG = util :: big_from_big_endian_chunks ( & toxic_waste . spec_r ) ; let combined_r = util :: ecp_from_big_endian_chunks ( & ciphertext . rr ) ; let combined_plaintexts : Vec < miracl :: BIG > = plaintext_chunks . iter ( ) . map ( | receiver_chunks | { util :: big_from_big_endian_chunks ( & receiver_chunks . iter ( ) . copied ( ) . map ( miracl :: BIG :: new_int ) . collect ( ) , ) } ) . collect ( ) ; crypto :: prove_sharing ( & crypto :: SharingInstance { g1_gen : miracl :: ECP :: generator ( ) , g2_gen : miracl :: ECP2 :: generator ( ) , public_keys : receiver_fs_public_keys . to_vec ( ) , public_coefficients : public_coefficients . to_vec ( ) , combined_randomizer : combined_r , combined_ciphertexts , } , & crypto :: SharingWitness { scalar_r : combined_r_scalar , scalars_s : combined_plaintexts , } , rng , ) }
Zero knowledge proof of correct sharing
Zero knowledge proof of correct sharing
receiver_fs_public_keys
&[miracl::ECP]
public_coefficients
&[miracl::ECP2]
ciphertext
&crypto::Crsz
plaintext_chunks
&[Vec<isize>]
toxic_waste
&crypto::ToxicWaste
rng
&mut crypto::RAND_ChaCha20
receiver_fs_public_keys
&[miracl::ECP]
public_coefficients
&[miracl::ECP2]
ciphertext
&crypto::Crsz
plaintext_chunks
&[Vec<isize>]
toxic_waste
&crypto::ToxicWaste
rng
&mut crypto::RAND_ChaCha20