美文网首页CTF Cryptoctf
RSA - 對模數n的因子分解

RSA - 對模數n的因子分解

作者: readilen | 来源:发表于2018-04-04 21:59 被阅读4次

    题目

    {920139713,19}
     
    704796792
    752211152
    274704164
    18414022
    368270835
    483295235
    263072905
    459788476
    483295235
    459788476
    663551792
    475206804
    459788476
    428313374
    475206804
    459788476
    425392137
    704796792
    458265677
    341524652
    483295235
    534149509
    425392137
    428313374
    425392137
    341524652
    458265677
    263072905
    483295235
    828509797
    341524652
    425392137
    475206804
    428313374
    483295235
    475206804
    459788476
    306220148
    

    1 分解n

    http://www.factordb.com/index.php?query=920139713
    http://www.atool.org/quality_factor.php
    或者

    import libnum
    libnum.factorial(920139713)
    

    2 求d

    from gmpy2 import *
    p = mpz(18443)
    q = mpz(49891)
    e = mpz(19)
    l = (p-1)*(q-1)
    d = invert(e, l)
    print("d is ", d)
    

    3 脱密

    把题中的n和e去掉,保存成文本rsa.txt

    n = 920139713
    d = 96849619
    result = []
    with open('rsa.txt') as f:
        for i in f:
            result.append(chr(pow(int(i), d, n)))
    

    得到
    'flag{13212je2ue28fy71w8u87y31r78eu1e2}'

    相关文章

      网友评论

        本文标题:RSA - 對模數n的因子分解

        本文链接:https://www.haomeiwen.com/subject/eamlhftx.html