You can start with the string version to get around and display it:
>>> import hashlib >>> string_version = hashlib.md5(b'hello world').hexdigest()
Convert it to binary to write it to disk:
>>> save_as_binary = string_version.encode('utf-8') >>> print(save_as_binary) b'5eb63bbbe01eeed093cb22bb8f5acdc3'
When reading it from disk, convert it back to line:
>>> back_to_string = save_as_binary.decode('utf-8') >>> print(back_to_string) 5eb63bbbe01eeed093cb22bb8f5acdc3
source share