fn inverse_shared(pk: PublicKey, sk: PrivateKey) -> Result<CompressedRistretto> {
    if sk.to_public().to_point().ct_eq(&pk.to_point()).unwrap_u8() == 1u8 {
        let msg = "same private keys".into();
        let source = None;
        let err = Error::Keys { msg, source };
        return Err(err);
    }

    if let Some(pk_point) = pk.to_point().decompress() {
        let sk_scalar = sk.to_scalar();

        let inv_shared = pk_point * (BASEPOINT_ORDER - sk_scalar);
        Ok(inv_shared.compress())
    } else {
        let msg = "invalid public key".into();
        let source = None;
        let err = Error::PublicKey { msg, source };
        Err(err)
    }
}
/// `inverse_shared` returns the inverse of the shared point by using the Lagrange's Theorem.
`inverse_shared` returns the inverse of the shared point by using the Lagrange's Theorem.
` inverse_shared ` returns the inverse of the shared point by using the Lagrange ' s Theorem .
fn inverse_shared(pk: PublicKey, sk: PrivateKey) -> Result<CompressedRistretto> {
    if sk.to_public().to_point().ct_eq(&pk.to_point()).unwrap_u8() == 1u8 {
        let msg = "same private keys".into();
        let source = None;
        let err = Error::Keys { msg, source };
        return Err(err);
    }
    if let Some(pk_point) = pk.to_point().decompress() {
        let sk_scalar = sk.to_scalar();
        let inv_shared = pk_point * (BASEPOINT_ORDER - sk_scalar);
        Ok(inv_shared.compress())
    } else {
        let msg = "invalid public key".into();
        let source = None;
        let err = Error::PublicKey { msg, source };
        Err(err)
    }
}
fn inverse_shared ( pk : PublicKey , sk : PrivateKey ) -> Result < CompressedRistretto > { if sk . to_public ( ) . to_point ( ) . ct_eq ( & pk . to_point ( ) ) . unwrap_u8 ( ) == 1u8 { let msg = " " . into ( ) ; let source = None ; let err = Error :: Keys { msg , source } ; return Err ( err ) ; } if let Some ( pk_point ) = pk . to_point ( ) . decompress ( ) { let sk_scalar = sk . to_scalar ( ) ; let inv_shared = pk_point * ( BASEPOINT_ORDER - sk_scalar ) ; Ok ( inv_shared . compress ( ) ) } else { let msg = " " . into ( ) ; let source = None ; let err = Error :: PublicKey { msg , source } ; Err ( err ) } }
`inverse_shared` returns the inverse of the shared point by using the Lagrange's Theorem.
` inverse_shared ` returns the inverse of the shared point by using the Lagrange ' s Theorem .
pk
PublicKey
sk
PrivateKey
pk
PublicKey
sk
PrivateKey