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

Deny 2k-reduce if lsd is zero #564

Merged
merged 1 commit into from
Mar 11, 2024
Merged

Conversation

czurnieden
Copy link
Contributor

Algorithm as implemented does not work if the least significant digit is zero.

Did not want to touch the algorithm itself (for now) so I put a check in mp_reduce_is_2k.c instead.

@czurnieden
Copy link
Contributor Author

It is an edgecase that falls right in the gap between reduce_2k and reduce_2k_l.

I'll try to come up with a solution that does not change the API and is not too slow but until than this fix is good enough; the edgcase n \equiv 0 (mod \beta) is relatively rare.

@sjaeckel sjaeckel merged commit fc17cf1 into libtom:develop Mar 11, 2024
79 checks passed
@sjaeckel sjaeckel linked an issue Mar 11, 2024 that may be closed by this pull request
@sjaeckel sjaeckel added this to the v2.0.0 milestone Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mp_exptmod incorrect result since version 0.32
2 participants