INNER CODE UNIT · Python
generate_random_gdtokenizer_seed
KnifeXRage/Godot-Secure · Godot Secure Scripts/universal/Godot Secure AES-256 Universal v6.py:50
def generate_random_gdtokenizer_seed(length: int = 64) -> str:
# secrets.token_hex(n) returns a string of 2 * n hex characters
return secrets.token_hex(length // 2)
def build_random_key_derivation():
operands = ["key_ptr[i]", "Security::TOKEN[i]"]
base_ops = [
"({a} ^ {b})",
"({a} + {b})",
"({a} | {b})",
"({a} & {b})",
"(({a} << {shift}) | ({a} >> {rshift}))",
"(({a} ^ {b}) + {const})",
"(({a} + {b}) ^ {const})",
]