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

Mod pow spike #1320

Closed
wants to merge 5 commits into from
Closed

Mod pow spike #1320

wants to merge 5 commits into from

Conversation

@metanest
Copy link

@metanest metanest commented Apr 5, 2016

A new method, Integer#mod_pow.

x.mod_pow(a, m) -> (x**a) % m

@metanest metanest closed this Dec 30, 2016
@metanest metanest force-pushed the metanest:mod_pow_spike branch from f2359a2 to 8fba800 Dec 30, 2016
@metanest metanest reopened this Dec 30, 2016
numeric.c Outdated
} else if (RB_TYPE_P(m, T_BIGNUM)) {
return int_pow_tmp3(rb_int_modulo(a, m), b, m, nega_flg);
} else {
assert(0);

This comment has been minimized.

@mrkn

mrkn Feb 22, 2017
Member

Use UNREACHABLE macro.

@mrkn
Copy link
Member

@mrkn mrkn commented Feb 22, 2017

@metanest Could you write tests for the new feature?

@mrkn mrkn self-assigned this Feb 22, 2017
@metanest metanest force-pushed the metanest:mod_pow_spike branch from d72f50b to 70596c0 Sep 19, 2017
@Ptico
Copy link

@Ptico Ptico commented Oct 17, 2017

mod pow often used for crypto, so may be it's better to use mpz_powm_sec?

@mrkn
Copy link
Member

@mrkn mrkn commented Dec 1, 2017

MEMO: The corresponding issue is https://bugs.ruby-lang.org/issues/12508

@matzbot matzbot closed this in 9b09cc8 Dec 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants