
solution.py
import string
# Open the file and read the encrypted content
with open("enc.bin", "r") as enc:
line = enc.read().strip()
# Loop through all letters and digits
for key in string.ascii_letters + string.digits:
# XOR each character in the line with the key to create the decrypted message
decrypted = ''.join([chr(ord(x) ^ ord(key)) for x in line])
# Check if all characters in the decrypted message are within the printable ASCII range
if all(32 <= ord(char) <= 126 for char in decrypted):
print(f"Key: {key} -> Decrypted: {decrypted}")
