Quadratique Mystérieuse
Challenge
Solution
cipher = [75794, 148031, 103514, 142971, 57039, 103514, 107826, 125954, 166434, 112226, 105659, 34511, 35754, 112226, 27515, 107826, 112226, 114459, 28626, 27515, 25359, 26426, 107826, 114459, 107826, 35754, 29759, 33290, 27515, 34511, 30914, 103514, 25359, 28626, 33290, 25359, 30914, 105659, 107826, 105659, 27515, 27515, 105659, 34511, 171890]
def func(x, a, b):
return a * x**2 + b
# Bruteforce de a et b
def find_ab():
for a in range(25):
for b in range(25):
if func(ord('S'), a, b) == cipher[0]:
return a, b
# Inverse la fonction quadratique
def inverse(x, a, b):
return int(pow((x - b) // a, 1/2))
a, b = find_ab()
flag = ''.join([chr(inverse(n, a, b)) for n in cipher])
print(flag)Mis à jour