Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- def decode(s):
- # from bytes to string
- plain_text_bytes = bytes.fromhex(s)
- # iterate over all characters
- for ind in range(256):
- # xor each char
- result = ''
- for t in plain_text_bytes:
- r = t ^ ind
- result += chr(r)
- # if given text is built with regex return answer
- if re.search("^[a-zA-Z0-9. -_?]*$", result):
- return result
- if __name__ == "__main__":
- s = input()
- result = decode(s)
- print(result)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement