RSATool.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:CTF-Crypto 作者: ValarDragon 项目源码 文件源码
def smallPrimes(self,n="n",upperlimit=1000000):
        if(n=="n"): n = self.modulus
        from sympy import sieve
        for i in sieve.primerange(1,upperlimit):
            if(n % i == 0):
                self.p = i
                self.q = n // i
                return

    #-----------------END SMALL PRIME SECTION-----------------#
    #----------------BEGIN POLLARDS P-1 SECTION---------------#

    #Pollard P minus 1 factoring, using the algorithm as described by
    # https://math.berkeley.edu/~sagrawal/su14_math55/notes_pollard.pdf
    # Then I further modified it by using the standard "B" as the limit, and only
    # taking a to the power of a prime. Then from looking at wikipedia and such,
    # I took the gcd out of the loop, and put it at the end.
    # TODO Update this to official wikipedia definition, once I find an explanation of
    # Wikipedia definition. (I.e. Why it works)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号