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

feat(ext/node): add crypto.checkPrime API #18465

Merged
merged 9 commits into from
Mar 28, 2023

Conversation

littledivy
Copy link
Member

@littledivy littledivy commented Mar 27, 2023

Towards #18455

This commit implements checkPrimeSync and checkPrime in node:crypto using the Miller-Rabin primality test (fun fact: it actually is a test for composite numbers)

It first compares the candidate against many known small primes and if not, proceeds to run the Miller-Rabin primality test. http:https://nickle.org/examples/miller-rabin.5c used as reference implementation.

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

LGTM, that's a lot of code to support these APIs 😬

@littledivy littledivy enabled auto-merge (squash) March 28, 2023 09:04
@littledivy littledivy merged commit 10012c2 into denoland:main Mar 28, 2023
mmastrac pushed a commit that referenced this pull request Mar 31, 2023
Towards #18455 

This commit implements `checkPrimeSync` and `checkPrime` in node:crypto
using the Miller-Rabin primality test (fun fact: it actually is a test
for composite numbers)

It first compares the candidate against many known small primes and if
not, proceeds to run the Miller-Rabin primality test.
http:https://nickle.org/examples/miller-rabin.5c used as reference
implementation.
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.

None yet

2 participants