2020DASCTF——七月赛
程序员文章站
2022-05-08 09:21:13
CRYPTO——bullshit题目源代码def pairing(a,b): shell = max(a, b) step = min(a, b) if step == b: flag = 0 else: flag = 1 return shell ** 2 + step * 2 + flagdef encrypt(message): res = '' for i in range(0,len(message)...
CRYPTO——bullshit
题目源代码
def pairing(a,b):
shell = max(a, b)
step = min(a, b)
if step == b:
flag = 0
else:
flag = 1
return shell ** 2 + step * 2 + flag
def encrypt(message):
res = ''
for i in range(0,len(message),2):
res += str(pairing(message[i],message[i+1]))
return res
print(encrypt(flag))
# 1186910804152291019933541010532411051999082499105051010395199519323297119520312715722
解题脚本
li = ['1','2','3','4','5','6','7','8','9','0','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t',
'u','v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P',
'Q','R','S','T','U','V','W','X','Y','Z','{','}','/',';','@','_','?','@','!']
def pairing(a,b):
if a > b:
return (a*a+b*2)
if a < b:
return (a*2+b*b+1)
res = [11869,10804,15229,10199,3354,10105,3241,10519,9908,2499,10505,10103,9519,9519,3232,9711,9520,3127,15722]
for n in range(len(res)):
for i in range(len(li)):
for j in range(len(li)):
if pairing(ord(li[i]),ord(li[j]))==res[n]:
print(li[i],li[j])
本文地址:https://blog.csdn.net/cwr1499640048/article/details/107580050