Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Int - inv_mod #727

Closed
wants to merge 12 commits into from
Closed

Conversation

erik-3milabs
Copy link
Contributor

Introduces the Int::inv_mod operation.

Status: awaiting the merge of #722.

Comment on lines -446 to 449
pub trait InvMod: Sized {
pub trait InvMod<Rhs = Self, Output = Self>: Sized {
/// Compute `1 / self mod p`.
fn inv_mod(&self, p: &Self) -> CtOption<Self>;
fn inv_mod(&self, p: &Rhs) -> CtOption<Output>;
}
Copy link
Contributor Author

@erik-3milabs erik-3milabs Jan 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This solution should (in theory?) just be an addition, not a breaking change.

However, perhaps the following solution might be neater:

pub trait InvMod: Sized {

    type Modulus;
    type Output;

    /// Compute `1 / self mod p`.
    fn inv_mod(&self, p: &Self::Modulus) -> Self::Output;
}

@tarcieri let's have a discussion about this to see what works best.

@erik-3milabs erik-3milabs mentioned this pull request Jan 9, 2025
10 tasks
@tarcieri tarcieri deleted the branch RustCrypto:signed-int January 9, 2025 14:44
@tarcieri tarcieri closed this Jan 9, 2025
This was referenced Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants