Skip to content

Instantly share code, notes, and snippets.

@BZHugs
Created February 21, 2018 13:28
Show Gist options
  • Save BZHugs/cdf9b5d8563c131a583b883ff95e2cd3 to your computer and use it in GitHub Desktop.
Save BZHugs/cdf9b5d8563c131a583b883ff95e2cd3 to your computer and use it in GitHub Desktop.
Solution for soupstitution Cipher EasyCTF 2018
#!/usr/bin/env python3
# coding: utf8
alpha = [chr(i) for i in range(999999) if chr(i).isdigit()][::-1]
def fcn2(txt):
a = 0
for c in txt:
a *= 10
a += ord(c) - ord('0')
return a
#flag="७552391"
search = "2365552391"
soluce = chr(2365 + ord('0')) #1st char must be 2365 + ord('0')
i = 5
for _ in range(6):
for c in alpha:
m = soluce + c
f = str(fcn2(m))
if f[:i] == search[:i]:
soluce += c
print(soluce)
i += 1
break
print("Soluce: ", soluce)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment