PyEncripto is a tool for encrypting Python source code and resources (assets) with secure runtime decryption. It is designed to protect intellectual property and create encrypted Python packages.
- 🔒 Encrypt
.pyfiles into.crptusing AES (CFB mode) - 📦 Package and encrypt resources (from
assets/folder) intoassets.pak - 🧹 Runtime loading of encrypted modules
- 🖼 Runtime loading and decryption of encrypted assets (images, sounds, etc.)
- 🔑 Support for encryption keys
- 🧪 Run encrypted projects with preserved
main.main()interface
pip install pyencriptopyencripto encrypt <source_folder> <output_folder> --key <key>Example:
pyencripto encrypt ./my_project ./my_project_crpt --key secret123What happens:
- All
.pyfiles are encrypted and saved with.crptextension - The
assets/folder is encrypted and packed intoassets.pak
⚠️ The.crptextension is mandatory! It is used by the module loader.
pyencripto run <encrypted_project_folder> <key>Example:
pyencripto run ./my_project_crpt secret123The project must contain an encrypted
main.crptfile with amain()function.
Original project:
my_project/
├── main.py # contains main()
├── utils/
│ └── helper.py
└── assets/
└── image.png
After encryption:
my_project_crpt/
├── main.crpt
├── utils/
│ └── helper.crpt
└── assets.pak
encryptor.py— handles project encryptionsecure_runtime.py— loads.crptmodules and decrypts assets at runtimecli.py— CLI interface (pyencripto encrypt|run)
- Python 3.10+
pycryptodome(automatically installed)
- Encryption makes reverse engineering harder but not impossible. Do not treat this as absolute protection.
- The key is stored only in memory but can be extracted during runtime.