import hashlib import secrets from server import PASS_SALT if __name__ == "__main__": try: name = input("Key for (the description of the key): ") if ";" in name: print("The character ';' is not allowed in the key name") exit(1) password = input("Password (no hidden input here): ") hashed = hashlib.pbkdf2_hmac("sha256", password.encode("utf-8"), PASS_SALT, 10000).hex() key_id = secrets.token_hex(6) claim_token = secrets.token_hex(12) print("The configuration line is:") print("{} = {};{};{}".format(key_id, name, claim_token, hashed)) print("The claim token is:") print("{}:{}".format(key_id, claim_token)) except KeyboardInterrupt: print("Cancelled")