21 lines
514 B
Python
21 lines
514 B
Python
import json
|
|
import hashlib
|
|
|
|
SALT = b"Lt2N5xgjJOqRsT5qVt7wWYw6SqOPZDI7"
|
|
|
|
|
|
def salted_hash_userid(player: dict):
|
|
uid = player["userId"]
|
|
hash_uid = hashlib.sha256(f"{uid}".encode("utf-8") + SALT)
|
|
player["userId"] = hash_uid.hexdigest()
|
|
|
|
|
|
def main():
|
|
with open("players.json", "r", encoding="utf-8") as f:
|
|
data = json.load(f)
|
|
for entry in data:
|
|
salted_hash_userid(entry)
|
|
|
|
with open("players_pub.json", "w", encoding="utf-8") as f:
|
|
json.dump(data, f, ensure_ascii=False)
|