26 lines
481 B
Python
Executable file
26 lines
481 B
Python
Executable file
# hash_data.py
|
|
# Made by user333_
|
|
# Meant to be included with main.py
|
|
|
|
from hashlib import sha256
|
|
from sys import exit
|
|
|
|
def hash_data(data: str) -> str:
|
|
|
|
try:
|
|
|
|
data = data.encode()
|
|
h = sha256()
|
|
h.update(data)
|
|
hashed_data = h.hexdigest()
|
|
return hashed_data
|
|
|
|
except Exception:
|
|
|
|
raise Exception(f"[ERROR] Failed to hash binary data '{data}'")
|
|
exit(1)
|
|
|
|
if __name__ == "__main__":
|
|
|
|
raise Exception("[ERROR] You ran the wrong script, run main.py instead.")
|
|
exit(1)
|