首页 > 其他分享 >2022冬 密码学趣题——1

2022冬 密码学趣题——1

时间:2023-01-26 22:44:29浏览次数:57  
标签:prime noise int prop 趣题 2022 print x00 密码学

HITCTF weird_relationship

from secret import flag
# rsa key generation phase :) a hint for you
# q = 1
# while not is_prime(q):
#     p = random_prime(2**512)
#     noise = randint(2**50, 2**51) * 2
#     q = 1337*(p + noise)**2 + 7331*p + 1
# print(b"Found the tasty prime couples :?")
# print(p)
# print(q)
# p = [REDACTED]
# q = [REDACTED]
n = 42281223026266109843683409681118610277610017116933717856285160716083325923418899921399912384205533143673068697213953854832112937986299982851528882496119429799676993137756826528817202721177191017404159423747620800036042008776355429046883195301825150458751448035881323000754250515270736764305017665841383652401183801845449690571064432230463927010255349396474019891980511609640555698032077835270181133120180108898601433761334599958033460390265794438104045904718661933
e = 2**16 + 1
m = int.from_bytes(flag, byteorder = "big")
c = pow(m, e, n)
print(c)
# c = 3528318136699440157664914506056633597368224752169169950632753898494454158424115366926095425749531868842874771964596508396972663383750763286285034629541063915735387547518003994077453821130849629958388768308449998767664057687468979091006268419207698084959237052794741550442575592311224791991420882101657879291324190611435577370047270182640408743508066884971144331157658093543197683834621836557941029254150133864346305341027175337233841704103517573602775811714443841

推式子,用大于p 51bit左右的noise进行coppersmith

exp:

n =42281223026266109843683409681118610277610017116933717856285160716083325923418899921399912384205533143673068697213953854832112937986299982851528882496119429799676993137756826528817202721177191017404159423747620800036042008776355429046883195301825150458751448035881323000754250515270736764305017665841383652401183801845449690571064432230463927010255349396474019891980511609640555698032077835270181133120180108898601433761334599958033460390265794438104045904718661933
c =3528318136699440157664914506056633597368224752169169950632753898494454158424115366926095425749531868842874771964596508396972663383750763286285034629541063915735387547518003994077453821130849629958388768308449998767664057687468979091006268419207698084959237052794741550442575592311224791991420882101657879291324190611435577370047270182640408743508066884971144331157658093543197683834621836557941029254150133864346305341027175337233841704103517573602775811714443841
e = 2**16 + 1
p_prop = previous_prime(int((n // 1337)^(1/3)))
R.<x> = PolynomialRing(Zmod(n), implementation='NTL')
f = p_prop - x
p = p_prop - int(f.monic().small_roots(X=2^51, beta=51/512)[0])
q = n // p
phi = lcm(p - 1, q - 1)
d = inverse_mod(e, phi)
print(int(pow(c, d, n)).to_bytes(128,byteorder = "big"))

#b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00HITCTF2022{plz_focus_on_application_part_of_cryptography$$_a_candy_for_your_passion$https://www.iacr.org/$}'

flag里还藏了个彩蛋

标签:prime,noise,int,prop,趣题,2022,print,x00,密码学
From: https://www.cnblogs.com/App1eTree/p/17068354.html

相关文章

  • My technical summary in 2022
    IntroIt'squitetoughformein2022.Iwentthroughchangingjob,injuryandcovidepidemic.AboutTechnology,IlearnedcudaandGPUprogrammingatthebeg......
  • 2022NOIP A层联测35
    好久之前的题了。A.弹珠游戏\(R,G,B\)任意时刻只能出现两种,出现第三种时优先匹配剩下两种的组合,再考虑形成新的组合,匹配啥是一样的,于是每次乘上方案数code#includ......
  • 年度征文 | 回顾2022,展望2023
    目录​​一、前言​​​​二、回顾2022​​​​三、展望2023​​个人主页: ​​ζ小菜鸡​​大家好我是ζ小菜鸡,感谢大家一直的支持。岁末年初,让我们一起回顾2022展望2023......
  • 2021-2022年部分个人作品一览
    2021-2022年部分模型截图              ---------------------------------------------------------------------------------------......
  • 2023 hgame趣题——3
    v2board搜索一下发现是最近的一个洞,主要是越权的问题,管理员鉴权的代码只判断了用户提交的token是否存在于服务器缓存抄个作业:https://youtu.be/yfneS2R-Pn8首先注册个账......
  • 2022前端年底面试总结
    又到年底了,很多小伙伴又开始​​跳槽​​​了,本次汇总都是​​面试真题​​​,来自各位小伙伴有​​大厂​​​也有​​小厂​​​,还有​​外包​​可以说很全面了。某外包公......
  • USACO2022 OPEN【杂题】
    A.[USACO22OPEN]262144RevisitedP对于一个长为\(m\)的序列\(b\),如下定义其权值:对其进行\(m-1\)次操作,每次选择相邻的两个数合并,合并后将其替换为一个大于两数最......
  • 2022ISCTF Crypto wp
    ISCTFCryptowp1.这是什么古典玩意题目:Theflagis:ISCTF{part1_part2_part3}example:part1:aaapart2:bbbpart3:!@#flag:ISCTF{aaa_bbb_!@#}-----------------......
  • sagemath密码学
    sage学习1.基本的环和域整数域,有理数域和实数域ZZ(3)QQ(0.25)RR(2^0.5)生成虚数单位ii=ComplexField().gen();(2+i)*(4+3*i)复数域CC(1,2)构造多项式环返回......
  • 2023 hgame趣题——2
    Helpmarvin最近在做hgameweek3的题,强度不小,Bi0s剩下那个密码(bad2code)过些天再更,今天发一个hgameweek1的IoT题目。SPI协议用单独的数据线和单独的时钟信号来保证发送......