You can't get there from here. A hash is a small refactoring of data that destroys virtually all of the information in the data. It is used to identify a revision of the data and can be used later to see if the data has changed. A good hash algorithm changes its output dramatically with even a 1 character change in the data. Consider a Midsummer Night's Dream on gutenberg.org. Its about 100,000 characters and its md5 hash is 16 bytes. You are not going to get the original back from that!
>>> import hashlib >>> import requests >>> night = requests.get("http://www.gutenberg.org/ebooks/1514.txt.utf-8") >>> len(night.text) 112127 >>> print(night.text[20000:20200]) h power to say, Behold! The jaws of darkness do devour it up: So quick bright things come to confusion. HERMIA If then true lovers have ever cross'd, It stands as an edict in destiny: Then let >>> print(night.text[20000:20300]) h power to say, Behold! The jaws of darkness do devour it up: So quick bright things come to confusion. HERMIA If then true lovers have ever cross'd, It stands as an edict in destiny: Then let us teach our trial patience, Because it is a customary cross; As due to love as thoughts, and dre >>> hash = hashlib.md5(night.text.encode("utf-8")).hexdigest() >>> print(hash) cce0d35b8b2c4dafcbde3deb983fec0a
The hash can be very useful to see if the text has changed:
>>> hash2 = hashlib.md5(requests.get("http://www.gutenberg.org/ebooks/1514.txt.utf-8").text.encode("utf-8")).hexdigest() >>> hash == hash2 True
decodeon an md5 object.