INNER CODE UNIT · Python

get_godot_version

KnifeXRage/Godot-Secure · Godot Secure Scripts/universal/Godot Secure AES-256 Universal v6.py:21

def get_godot_version(path):
    if os.path.isdir(path):
        path = os.path.join(path, "version.py")

    version = {}
    with open(path, encoding="utf-8") as f:
        exec(f.read(), {}, version)

    return version["major"] * 10 + version["minor"] # returns 46 for v4.6.x

def generate_random_tag(length=4):
    return ''.join(random.choices(string.ascii_uppercase, k=length))

def generate_random_token(length=32):
    return bytes([random.randint(0, 255) for _ in range(length)])

def hex_to_bytes(hex_string: str) -> bytes:
    return bytes.fromhex(hex_string)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…