From: Travis Wrightsman Date: Fri, 10 Jul 2026 20:40:20 -0700 Subject: Make generated doc data hash deterministic Python's build-in hash() is intentionally randomized between processes. This prevents Godot from building reproducibly since identical source input produces different hashed values each build. SHA-256 is used here as a deterministic alternative hash function. Forwarded: https://github.com/godotengine/godot/pull/121235 --- editor/editor_builders.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/editor/editor_builders.py b/editor/editor_builders.py index 43b434f..57b7424 100644 --- a/editor/editor_builders.py +++ b/editor/editor_builders.py @@ -1,5 +1,6 @@ """Functions used to generate source files during build time""" +import hashlib import os import os.path import subprocess @@ -59,7 +60,7 @@ def make_doc_header(target, source, env): with methods.generated_wrapper(str(target[0])) as file: file.write(f"""\ -inline constexpr const char *_doc_data_hash = "{hash(buffer)}"; +inline constexpr const char *_doc_data_hash = "{hashlib.sha256(buffer).hexdigest()}"; inline constexpr int _doc_data_compressed_size = {len(buffer)}; inline constexpr int _doc_data_uncompressed_size = {decomp_size}; inline constexpr const unsigned char _doc_data_compressed[] = {{