GodotCipher is an automated encryption integration tool for the Godot Engine. It modifies the engine source code to enable PCK encryption with minimal manual intervention.
- 🔐 Automatic Key Generation – Generates secure AES-256 encryption keys and security tokens
- 🛡️ Token-Based Obfuscation – XOR-based key derivation with embedded security token
- 📦 One-Command Setup – Single command to patch the entire engine
- 💾 Automatic Backups – Creates
.bakbackups before any modification - 🔄 Restore Functionality – Restore to original state with
--restoreflag - ⚙️ CI/CD Ready – Native GitHub Actions support for automated builds
- 📋 Configuration Persistence – Saves settings to
godot_cipher.json
# Clone Godot source
git clone https://github.com/godotengine/godot.git
cd godot
# Run GodotCipher
python godot_cipher.py --fast .
# Clean up duplicate code (optional but recommended)
python godot_cipher_delete.py
# Build the engine with encryption support
scons platform=windows target=template_release📖 Usage
# Interactive mode
python godot_cipher.py /path/to/godot/source
# Fast mode (no prompts)
python godot_cipher.py --fast /path/to/godot/source
# Preview changes only
python godot_cipher.py --dry-run /path/to/godot/source
# Restore from latest backup
python godot_cipher.py --restore /path/to/godot/source
# Clean up duplicate ctx definitions (after patching)
python godot_cipher_delete.py🔧 Environment Variable
Set the encryption key for CI/CD environments:
export GODOT_CIPHER_KEY="your_64_character_hex_key"📁 Output
After execution, the following files are created/modified:
File Description godot_cipher.json Configuration backup godot_cipher.log Execution log .bak_ Automatic backups core/crypto/security_token.h Security token header
🛠 Requirements
· Python 3.8+ · Godot 4.x source code · SCons (for rebuilding)
The encryption key used during export must match the key used at compile time. Without the correct key, encrypted PCK files cannot be read.
❓ Troubleshooting
"PCK file not recognized" after export
→ Your export-time encryption key doesn't match the compile-time key. Check godot_cipher.json for the key used during patching.
Build fails with "security_token.h not found"
→ Run python godot_cipher.py --restore . then re-run the patching process.
Duplicate ctx definition compilation error
→ Run python godot_cipher_delete.py after godot_cipher.py to clean up duplicate code blocks.
🤝 Acknowledgments
This project was inspired by Godot-Secure by KnifeXRage. Special thanks for the original concept.
📄 License
Distributed under the MIT License. See LICENSE file for details.
🙏 Support
If this tool helps you, consider starring the repository ⭐