目录
-
- robomunication
- Dangerous RSA
- Cipher
- [HDCTF2019]basic rsa
- [GXYCTF2019]CheckIn
- [GUET-CTF2019]BabyRSA
- 达芬奇密码
- 密码学的心声
- rsa2
- [BJDCTF2020]这是base??
- RSA5
- [NCTF2019]childRSA
- [NCTF2019]Keyboard
- [MRCTF2020]古典密码知多少
- [HDCTF2019]bbbbbbrsa
- 这是什么
- [WUSTCTF2020]佛说:只能四天
- [BJDCTF2020]RSA
- [MRCTF2020]天干地支+甲子
- [BJDCTF2020]rsa_output
- [MRCTF2020]vigenere
- [ACTF新生赛2020]crypto-rsa0
- [BJDCTF2020]signin
- [MRCTF2020]keyboard
- RSA4
- [WUSTCTF2020]babyrsa
- [GWCTF 2019]BabyRSA
- SameMod
- 一张谍报
- [BJDCTF2020]easyrsa
robomunication
听着就是莫斯密码,读的有点搞笑hah
hellowhatisthekeyitisboopbeep
flag为大写的boopbeep
Dangerous RSA
低加密指数攻击
n=0x52d483c27cd806550fbe0e37a61af2e7cf5e0efb723dfc81174c918a27627779b21fa3c851e9e94188eaee3d5cd6f752406a43fbecb53e80836ff1e185d3ccd7782ea846c2e91a7b0808986666e0bdadbfb7bdd65670a589a4d2478e9adcafe97c6ee23614bcb2ecc23580f4d2e3cc1ecfec25c50da4bc754dde6c8bfd8d1fc16956c74d8e9196046a01dc9f3024e11461c294f29d7421140732fedacac97b8fe50999117d27943c953f18c4ff4f8c258d839764078d4b6ef6e8591e0ff5563b31a39e6374d0d41c8c46921c25e5904a817ef8e39e5c9b71225a83269693e0b7e3218fc5e5a1e8412ba16e588b3d6ac536dce39fcdfce81eec79979ea6872793
e=0x3
c=0x10652cdfaa6b63f6d7bd1109da08181e500e5643f5b240a9024bfa84d5f2cac9310562978347bb232d63e7289283871efab83d84ff5a7b64a94a79d34cfbd4ef121723ba1f663e514f83f6f01492b4e13e1bb4296d96ea5a353d3bf2edd2f449c03c4a3e995237985a596908adc741f32365
import gmpy2
import libnum
k = 0
while 1:
res = gmpy2.iroot(c+k*n,e)
if res[1] == True:
print(libnum.n2s(int(res[0])))
print(k)
k += 1
Cipher
还能提示什么呢?公平的玩吧(密钥自己找) Dncnoqqfliqrpgeklwmppu 注意:得到的 flag 请包上 flag{} 提交, flag{小写字母}
密钥是playfair
解密网站http://rumkin.com/tools/cipher/playfair.php
[HDCTF2019]basic rsa
import gmpy2
from Crypto.Util.number import *
from binascii import a2b_hex,b2a_hex
flag = "*****************"
p = 262248800182277040650192055439906580479
q = 262854994239322828547925595487519915551
e = 65533
n = p*q
phi_n = (p-1)*(q-1)
c = 27565231154623519221597938803435789010285480123476977081867877272451638645710
d = gmpy2.invert(e,phi_n)
m = pow(c,d,n)
print(long_to_bytes(m))
# 27565231154623519221597938803435789010285480123476977081867877272451638645710
[GXYCTF2019]CheckIn
base64之后rot47
[GUET-CTF2019]BabyRSA
pq1= 0x1232fecb92adead91613e7d9ae5e36fe6bb765317d6ed38ad890b4073539a6231a6620584cea5730b5af83a3e80cf30141282c97be4400e33307573af6b25e2ea
pq2 = 0x5248becef1d925d45705a7302700d6a0ffe5877fddf9451a9c1181c4d82365806085fd86fbaab08b6fc66a967b2566d743c626547203b34ea3fdb1bc06dd3bb765fd8b919e3bd2cb15bc175c9498f9d9a0e216c2dde64d81255fa4c05a1ee619fc1fc505285a239e7bc655ec6605d9693078b800ee80931a7a0c84f33c851740
e = 0xe6b1bee47bd63f615c7d0a43c529d219
d = 0x2dde7fbaed477f6d62838d55b0d0964868cf6efb2c282a5f13e6008ce7317a24cb57aec49ef0d738919f47cdcd9677cd52ac2293ec5938aa198f962678b5cd0da344453f521a69b2ac03647cdd8339f4e38cec452d54e60698833d67f9315c02ddaa4c79ebaa902c605d7bda32ce970541b2d9a17d62b52df813b2fb0c5ab1a5
enc_flag = 0x50ae00623211ba6089ddfae21e204ab616f6c9d294e913550af3d66e85d0c0693ed53ed55c46d8cca1d7c2ad44839030df26b70f22a8567171a759b76fe5f07b3c5a6ec89117ed0a36c0950956b9cde880c575737f779143f921d745ac3bb0e379c05d9a3cc6bf0bea8aa91e4d5e752c7eb46b2e023edbc07d24a7c460a34a9a
import gmpy2
from Crypto.Util.number import *
n = int(pq2) - int(pq1) -1
m = pow(int(enc_flag),int(d),int(n))
print(long_to_bytes(m))
达芬奇密码
按照斐波那契数列和数列1的位置来排序数列2
a = '1 233 3 2584 1346269 144 5 196418 21 1597 610 377 10946 89 514229 987 8 55 6765 2178309 121393 317811 46368 4181 1 832040 2 28657 75025 34 13 17711'.split(' ')
# def fib_recur(n):
# assert n >= 0, "n > 0"
# if n <= 1:
# return n
# return fib_recur(n-1) + fib_recur(n-2)
#
# for i in range(1, 40):
# print(fib_recur(i), end=' ')
flag = [''for i in range(32)]
print(flag)
b = '1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 1346269 2178309'.split(' ')
c = '36968853882116725547342176952286'
for indexa,i in enumerate(a):
for indexb,j in enumerate(b):
if i == j:
flag[indexb] = c[indexa]
print(indexa,indexb,flag)
flag[0] = '3'
for i in flag:
print(i,end='')
密码学的心声
8进制的ASCII码
s = '111 114 157 166 145 123 145 143 165 162 151 164 171 126 145 162 171 115 165 143 150'
tmp = [s.split(' ')[i] for i in range(len(s.split(' ')))]
for i in tmp:
print(chr(int(i,8)),end='')
rsa2
#python2
import hashlib
import RSAwienerHacker
N = 101991809777553253470276751399264740131157682329252673501792154507006158434432009141995367241962525705950046253400188884658262496534706438791515071885860897552736656899566915731297225817250639873643376310103992170646906557242832893914902053581087502512787303322747780420210884852166586717636559058152544979471
e = 46731919563265721307105180410302518676676135509737992912625092976849075262192092549323082367518264378630543338219025744820916471913696072050291990620486581719410354385121760761374229374847695148230596005409978383369740305816082770283909611956355972181848077519920922059268376958811713365106925235218265173085
d = RSAwienerHacker.hack_RSA(e,N)
print(d)
flag = "flag{" + hashlib.md5(hex(d)).hexdigest() + "}"
print(flag)
[BJDCTF2020]这是base??
base64换表
import base64
import string
dict={
0: 'J', 1: 'K', 2: 'L', 3: 'M', 4: 'N', 5: 'O', 6: 'x', 7: 'y', 8: 'U', 9: 'V', 10: 'z', 11: 'A', 12: 'B', 13: 'C', 14: 'D', 15: 'E', 16: 'F', 17: 'G', 18: 'H', 19: '7', 20: '8', 21: '9', 22: 'P', 23: 'Q', 24: 'I', 25: 'a', 26: 'b', 27: 'c', 28: 'd', 29: 'e', 30: 'f', 31: 'g', 32: 'h', 33: 'i', 34: 'j', 35: 'k', 36: 'l', 37: 'm', 38: 'W', 39: 'X', 40: 'Y', 41: 'Z', 42: '0', 43: '1', 44: '2', 45: '3', 46: '4', 47: '5', 48: '6', 49: 'R', 50: 'S', 51: 'T', 52: 'n', 53: 'o', 54: 'p', 55: 'q', 56: 'r', 57: 's', 58: 't', 59: