Crypto - Leonine Misbegotten
Challenge Summary
ENCODED_DATA + SHA1
ENCODED_DATA + SHA1
...Solve.py
from base64 import b16decode, b32decode, b64decode, b85decode
from hashlib import sha1
SCHEMES = [b16decode, b32decode, b64decode, b85decode]
with open("output", "rb") as f:
data = f.read()
for round in range(16):
new_data = None
checksum = data[-20:] # SHA-1 is 20 bytes
candidate = data[:-20]
for dec in SCHEMES:
try:
decoded = dec(candidate)
if sha1(decoded).digest() == checksum:
new_data = decoded
break
except Exception:
pass
if new_data is None:
raise Exception("Failed at round", round)
data = new_data
print(data.decode())
Last updated

