zoukankan      html  css  js  c++  java
  • Nahamcon-Raspberry

    下载附件后,直接给出了p,q,e

    n = 7735208939848985079680614633581782274371148157293352904905313315409418467322726702848189532721490121708517697848255948254656192793679424796954743649810878292688507385952920229483776389922650388739975072587660866986603080986980359219525111589659191172937047869008331982383695605801970189336227832715706317
    e = 65537
    c = 5300731709583714451062905238531972160518525080858095184581839366680022995297863013911612079520115435945472004626222058696229239285358638047675780769773922795279074074633888720787195549544835291528116093909456225670152733191556650639553906195856979794273349598903501654956482056938935258794217285615471681

    分解n发现存在很多质因数(估计这也就是为什么题目为覆盆子的原因)

    >>> from factordb.factordb import FactorDB
    >>> import gmpy2
    >>> n = 7735208939848985079680614633581782274371148157293352904905313315409418467322726702848189532721490121708517697848255948254656192793679424796954743649810878292688507385952920229483776389922650388739975072587660866986603080986980359219525111589659191172937047869008331982383695605801970189336227832715706317
    >>> e=65537
    >>> c=5300731709583714451062905238531972160518525080858095184581839366680022995297863013911612079520115435945472004626222058696229239285358638047675780769773922795279074074633888720787195549544835291528116093909456225670152733191556650639553906195856979794273349598903501654956482056938935258794217285615471681
    >>> factornum=FactorDB(n)
    >>> factornum.connect()
    <Response [200]>
    >>> factor_list = factornum.get_factor_list()
    >>> print(factor_list)
    [2208664111, 2214452749, 2259012491, 2265830453, 2372942981, 2393757139, 2465499073, 2508863309, 2543358889, 2589229021, 2642723827, 2758626487, 2850808189, 2947867051, 2982067987, 3130932919, 3290718047, 3510442297, 3600488797, 3644712913, 3650456981, 3726115171, 3750978137, 3789130951, 3810149963, 3979951739, 4033877203, 4128271747, 4162800959, 4205130337, 4221911101, 4268160257]

    计算n的欧拉函数phi,并得出flag

    >>> for num in factor_list:
    ...     num = num-1
    ...     x*=num
    ... 
    >>> print(x)
    7735208858912013174807786153875265311232475601814043799113971819203978928431722767684674067119725000291122190443795615639597996271053342184657566093781734940605689774479814988576374248690133868658052837262849840790750991863632288857652325134901612884172359123108137383953436272360300748996608000000000000
    >>> phi = x#n的欧拉函数
    >>> d=gmpy2.invert(e,phi)
    >>> 
    >>> s=pow(c,d,n)
    >>> from Crypto.Util.number import long_to_bytes
    >>> print(long_to_bytes(s))
    b'flag{there_are_a_few_extra_berries_in_this_one}'
  • 相关阅读:
    django ajax使用
    vim--分屏快捷键
    django csrf
    django mysql使用
    官方文档地址
    图解http 学习
    Terms
    Data Center Group
    Misc
    FTDI CDM Drivers 2.06.00
  • 原文地址:https://www.cnblogs.com/jane315/p/13175999.html
Copyright © 2011-2022 走看看