'Is there a pre-existing implementation of the General Number Field Sieve (GNFS) in Python?

Is there any inbuilt or online Implementation of GNFS factoring in Python? I need a version that can easily be used to factor integers in other programs so I would need to import and preferably is comparable with or only needs minimal change to work with Python 3. I need this to factor (multiple) numbers of over 90 digits in length and elliptic curve factorization is too slow for the purpose.

I have checked online and could only find Perl and C++ implementations. If not is there any online resource that could guide me step by step to my own implementation of this algorithm?



Solution 1:[1]

the pearl wrapper for GGNFS (c implementation) was rewritten into python by Brian Gladman.
Look for factmsieve.py

Solution 2:[2]

Yes, you can use primefac

which works this way:

python3 -m primefac 24 ! 1 - 38 ! 1 +

and in seconds you will have the results:

enter image description here

Solution 3:[3]

See This Code!

from primefac import primefac
def Factorize(n):
    B = True
    try:
        Function = primefac(n)
        while B:
            print(next(Function))
     except:
         B = False

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Lapidary arts
Solution 2
Solution 3 Summation