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

Fixes #1431: Incorrect results from exponentModulo. #1433

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

ianacaburian
Copy link

Changes:

  • Removed incorrect mod op on exponent.
  • Handled base case for zero exponent.

Tests:

  • Tested against modPow by jsbn
  • Tested 100 runs of random hex strings with lengths 300 - 1000 using fast-check: ✓ src/JuceBigInteger.test.ts (1) 1776566ms ✓ JuceBigInteger (1) 1776565ms ✓ exponentModulo (1) 1776565ms
  • Double-checked counter examples on Omni Calculator:
    • b=x, e=0, m=y
    • b=3, e=8, m=5
    • b=0x1400000007, e=0x1400000006, m=0x1400000005

Source:

Thank you for submitting a pull request.

Please make sure you have read and followed our contribution guidelines (.github/contributing.md in this repository). Your pull request will not be accepted if you have not followed the instructions.

Changes:
- Removed incorrect mod op on exponent.
- Handled base case for zero exponent.

Tests:
- Tested against modPow by [jsbn](https://github.com/creationix/jsbn)
- Tested 100 runs of random hex strings with lengths 300 - 1000 using [fast-check](https://github.com/dubzzz/fast-check):
 ✓ src/JuceBigInteger.test.ts (1) 1776566ms
   ✓ JuceBigInteger (1) 1776565ms
     ✓ exponentModulo (1) 1776565ms
- Double-checked counter examples on [Omni Calculator](https://www.omnicalculator.com/math/power-modulo):
	- b=x, e=0, m=y
	- b=3, e=8, m=5
	- b=0x1400000007, e=0x1400000006, m=0x1400000005

Source:
- Find the tests in this project: [@ianacaburian/generate-key-file](https://github.com/ianacaburian/generate-key-file/tree/develop)
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.

1 participant