if __name__ == '__main__': c = [0x2E63829D, 0xC14E400F, 0x9B39BFB9, 0x5A1F8B14, 0x61886DDE, 0x6565C6CF, 0x9F064F64, 0x236A43F6, 0x7D6B] cc = [long_to_bytes(k)[::-1] for k in c] key = [0x12345678, 0x23456789, 0x34567890, 0x45678901] flag = b'' for i inrange(len(c)//2): d = decrypt(c[2*i:2*(i+1)], key) flag += long_to_bytes(d[0])[::-1]+long_to_bytes(d[1])[::-1] flag += long_to_bytes(c[-1])[::-1] print(flag) # b'hgame{Tea_15_4_v3ry_h3a1thy_drlnk}'
crypto
小轮子RSA
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
from Crypto.Util.number import *
flag = open('flag.txt', 'rb').read()
p = getPrime(512) q = getPrime(512) n=p*q e = 65537 m = bytes_to_long(flag) c = pow(m, e, n) print(f"c={c}") print(f"n={n}")
p = 11239134987804993586763559028187245057652550219515201768644770733869088185320740938450178816138394844329723311433549899499795775655921261664087997097294813 q = 12022912661420941592569751731802639375088427463430162252113082619617837010913002515450223656942836378041122163833359097910935638423464006252814266959128953 n = p*q c = 110674792674017748243232351185896019660434718342001686906527789876264976328686134101972125493938434992787002915562500475480693297360867681000092725583284616353543422388489208114545007138606543678040798651836027433383282177081034151589935024292017207209056829250152219183518400364871109559825679273502274955582 e = 65537
f = (p-1)*(q-1) d = inverse_mod(e,f) m = pow(c,d,n) print(bytes.fromhex(hex(m)[2:]))
# hgame{factordb.com_is_strong!}
2024-12-14
[HNCTF 2022 WEEK4]checker.flare-on8
可以输入 Admin 和 base64(goldenticket)
也可以直接逆flag(逐位异或)
[HNCTF 2022 Week1]贝斯是什么乐器啊?
1 2 3 4 5 6
import base64
a = 'TlJRQFBBdTs4alsrKFI6MjgwNi5p' a = base64.b64decode(a) for i inrange(len(a)): print(chr((a[i])+i),end='')