0

in this case I want to execute my hashed python code.

but the problem is, how can I do the hash and then decode the hash that I did earlier. then execute the python code that was hashed on the python compiler.

in example i have simple code :

print('Hello World!')

decode code to plain text :

>> import base64
>> encoded = b'cHJpbnQoIkhlbGxvIFdvcmxkISIp' 
>> decoded = base64.b64decode(encoded)
>> decoded
>> b'print("Hello World!")'

the decoded will execute the code as plain text. so, how to get the compiler to run it as python code ?

  • Does this answer your question? [How do I execute a string containing Python code in Python?](https://stackoverflow.com/questions/701802/how-do-i-execute-a-string-containing-python-code-in-python) – Thomas Schillaci Feb 19 '20 at 10:41
  • 1
    Base64 != hash. Hashing is meant to be one-way. Once something is hashed, it's very very very difficult to get back the original from the hash. The word you should be using is "encoding/decoding". SHA256 is a hash. And you wouldn't be able to get back the original string from it (not without a lot of work anyway). – rdas Feb 19 '20 at 10:43
  • @rdas so base64 is not hash. i should learn more, thank you for knowledge – Ghiba Khan Feb 19 '20 at 10:49

0 Answers0