Project is now named Celeste
This commit is contained in:
parent
87917f9526
commit
269092fb53
45 changed files with 1507 additions and 12 deletions
24
README
24
README
|
|
@ -2,3 +2,27 @@ The "imbaud python library" (imp lib), or just imp for short!
|
|||
|
||||
TODO:
|
||||
- define a getPrime function like PyCryptodome's
|
||||
- rewrite nim-lang/bigints to implement features like Karatsuba multiplication, or even Toom-3 multiplication
|
||||
|
||||
|
||||
PyCryptodome defines getPrime as follows:
|
||||
```py
|
||||
def getPrime(N, randfunc=None):
|
||||
"""Return a random N-bit prime number.
|
||||
|
||||
N must be an integer larger than 1.
|
||||
If randfunc is omitted, then :meth:`Random.get_random_bytes` is used.
|
||||
"""
|
||||
if randfunc is None:
|
||||
randfunc = Random.get_random_bytes
|
||||
|
||||
if N < 2:
|
||||
raise ValueError("N must be larger than 1")
|
||||
|
||||
while True:
|
||||
number = getRandomNBitInteger(N, randfunc) | 1
|
||||
if isPrime(number, randfunc=randfunc):
|
||||
break
|
||||
return number
|
||||
```
|
||||
in essence infinite random generation until a prime is found
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue