Skip to content

Add support for custom Sieves. #61

@lleoha

Description

@lleoha

The title should actually be: "Support for custom Sieves or other means to generate primes of specific forms".

Rationale:
In many cases one wants to have a prime with some additional constraints, e.g. with k most significant bits set or k least significant bits sets or both (e.g. take a look at safe primes defined in RFC3526.
In my specific use case I want to have an RSA modulus with MSB set hence I need two primes which have two MSB bits set. I also want them for the reasons being out of scope of this description to be congruent to 3 mod 4, i.e. two LSB set (but not necessarily safe primes).

Currently I am using my own custom primality tests, but having a way to specify custom sieve (or whatever that would sieve out the prime candidate based on specified predicate) would allow me to use this crate.

Let me know what you think. I can work on implementation if there's an interest in that.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions