INNER CODE UNIT · Python
apply_buffer_scramble
KnifeXRage/Godot-Secure · Godot Secure Scripts/universal/Godot Secure AES-256 Universal v6.py:146
def apply_buffer_scramble(filepath, buffer_seed):
seed_hash = int(hashlib.md5(buffer_seed.encode()).hexdigest(), 16)
random.seed(seed_hash)
if not os.path.exists(filepath):
print_error(f"File not found at {filepath}")
return False
# Locate gdscript_tokenizer.h in the same directory
dir_name = os.path.dirname(filepath)
tokenizer_h_path = os.path.join(dir_name, "gdscript_tokenizer.h")
try:
actual_tk_max = get_actual_tk_max(tokenizer_h_path)
print_success(f"Auto-detected Token::TK_MAX = {actual_tk_max}")
except Exception as e:
print_error(f"Error parsing TK_MAX: {e}")