rsa1.py 文件源码

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

项目:ctf-library 作者: Hcamael 项目源码 文件源码
def get_ed(p, q):
    k = cal_bit(q*p)
    phi_n = (p-1)*(q-1)
    r = random.randint(10, 99)
    while True:
        u = getPrime(k/4 - r)
        if gcd(u, phi_n) != 1:
            continue
        t = invmod(u, phi_n)
        e = pi_b(t)
        if gcd(e, phi_n) == 1:
            break
    d = invmod(e, phi_n)
    return (e, d)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号