import hashlib import json from datetime import datetime def compute_sha256(data): sha256_hash = hashlib.sha256() sha256_hash.update(data.encode("utf-8")) return sha256_hash.hexdigest() def main(): # create datetime object with date 25/10/2121 date_obj = datetime.strptime("25/10/2121", "%d/%m/%Y") json_data = json.dumps({"date": date_obj.strftime("%d/%m/%Y")}) print(compute_sha256(json_data)) print(json_data) if __name__ == '__main__': main()