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

Implement modular inverse #60

Open
dignifiedquire opened this issue Jul 19, 2018 · 5 comments
Open

Implement modular inverse #60

dignifiedquire opened this issue Jul 19, 2018 · 5 comments

Comments

@dignifiedquire
Copy link
Contributor

I had the need for this and have a variant that works well for positive numbers here, if there is interest: https://github.com/dignifiedquire/rust-rsa/blob/master/src/math.rs#L118

@dmhacker
Copy link

dmhacker commented Jul 20, 2018

I second this. I would add that I also have a variant that uses the extended Euclidean algorithm, but it seems to be failing for large negative numbers.

@cuviper
Copy link
Member

cuviper commented Jul 21, 2018

This will probably be met generically by rust-num/num-integer#10.

@dignifiedquire
Copy link
Contributor Author

That would be nice, but this should be still implemented in here, as the properly optimized algorithms take into account the actual digits/limbs, which are not available on the generalized Integer as far as I understand.

@mikong
Copy link
Contributor

mikong commented Mar 21, 2019

@dignifiedquire, your link is currently redirecting then returning 404 for me. The RustCrypto/RSA repo doesn't have a src/math.rs, but I can see that it uses a ModInverse trait and that the trait is implemented in your fork of num-bigint. Is that where you'd like us to look at?

@dignifiedquire
Copy link
Contributor Author

yes, that code moved out of the RSA library into my fork of num-bigint into: https://github.com/dignifiedquire/num-bigint/blob/master/src/algorithms/mod_inverse.rs

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

No branches or pull requests

4 participants