pub fn sign(
    signing_package: &SigningPackage,
    participant_nonces: SigningNonces,
    share_package: &SharePackage,
) -> Result<SignatureShare, &'static str> {
    let mut bindings: HashMap<u64, Scalar> =
        HashMap::with_capacity(signing_package.signing_commitments.len());

    for comm in signing_package.signing_commitments.iter() {
        let rho_i = gen_rho_i(comm.index, &signing_package);
        bindings.insert(comm.index, rho_i);
    }

    let lambda_i = gen_lagrange_coeff(share_package.index, &signing_package)?;

    let group_commitment = gen_group_commitment(&signing_package, &bindings)?;

    let challenge = gen_challenge(
        &signing_package,
        &group_commitment,
        &share_package.group_public,
    );

    let participant_rho_i = bindings
        .get(&share_package.index)
        .ok_or("No matching binding!")?;

    // The Schnorr signature share
    let signature: Scalar = participant_nonces.hiding
        + (participant_nonces.binding * participant_rho_i)
        + (lambda_i * share_package.share.value.0 * challenge);

    Ok(SignatureShare {
        index: share_package.index,
        signature: SignatureResponse(signature),
    })
}
/// Performed once by each participant selected for the signing operation.
///
/// Receives the message to be signed and a set of signing commitments and a set
/// of randomizing commitments to be used in that signing operation, including
/// that for this participant.
///
/// Assumes the participant has already determined which nonce corresponds with
/// the commitment that was assigned by the coordinator in the SigningPackage.
Performed once by each participant selected for the signing operation.
Receives the message to be signed and a set of signing commitments and a set
of randomizing commitments to be used in that signing operation, including
that for this participant.

Assumes the participant has already determined which nonce corresponds with
the commitment that was assigned by the coordinator in the SigningPackage.
Performed once by each participant selected for the signing operation . Receives the message to be signed and a set of signing commitments and a set of randomizing commitments to be used in that signing operation including that for this participant . Assumes the participant has already determined which nonce corresponds with the commitment that was assigned by the coordinator in the SigningPackage .
pub fn sign(
    signing_package: &SigningPackage,
    participant_nonces: SigningNonces,
    share_package: &SharePackage,
) -> Result<SignatureShare, &'static str> {
    let mut bindings: HashMap<u64, Scalar> =
        HashMap::with_capacity(signing_package.signing_commitments.len());
    for comm in signing_package.signing_commitments.iter() {
        let rho_i = gen_rho_i(comm.index, &signing_package);
        bindings.insert(comm.index, rho_i);
    }
    let lambda_i = gen_lagrange_coeff(share_package.index, &signing_package)?;
    let group_commitment = gen_group_commitment(&signing_package, &bindings)?;
    let challenge = gen_challenge(
        &signing_package,
        &group_commitment,
        &share_package.group_public,
    );
    let participant_rho_i = bindings
        .get(&share_package.index)
        .ok_or("No matching binding!")?;
    // The Schnorr signature share
    let signature: Scalar = participant_nonces.hiding
        + (participant_nonces.binding * participant_rho_i)
        + (lambda_i * share_package.share.value.0 * challenge);
    Ok(SignatureShare {
        index: share_package.index,
        signature: SignatureResponse(signature),
    })
}
pub fn sign ( signing_package : & SigningPackage , participant_nonces : SigningNonces , share_package : & SharePackage , ) -> Result < SignatureShare , & ' static str > { let mut bindings : HashMap < u64 , Scalar > = HashMap :: with_capacity ( signing_package . signing_commitments . len ( ) ) ; for comm in signing_package . signing_commitments . iter ( ) { let rho_i = gen_rho_i ( comm . index , & signing_package ) ; bindings . insert ( comm . index , rho_i ) ; } let lambda_i = gen_lagrange_coeff ( share_package . index , & signing_package ) ? ; let group_commitment = gen_group_commitment ( & signing_package , & bindings ) ? ; let challenge = gen_challenge ( & signing_package , & group_commitment , & share_package . group_public , ) ; let participant_rho_i = bindings . get ( & share_package . index ) . ok_or ( " " ) ? ; // The Schnorr signature share let signature : Scalar = participant_nonces . hiding + ( participant_nonces . binding * participant_rho_i ) + ( lambda_i * share_package . share . value . 0 * challenge ) ; Ok ( SignatureShare { index : share_package . index , signature : SignatureResponse ( signature ) , } ) }
Performed once by each participant selected for the signing operation.
Performed once by each participant selected for the signing operation .
signing_package
&SigningPackage
participant_nonces
SigningNonces
share_package
&SharePackage