🛡️ PyVault
Shield and lock your Python source code in a vault, forever.
PyVault is a VS Code extension that obfuscates your Python source code — making it extremely difficult to read or reverse-engineer while keeping it fully functional.
Features
- 🔤 Rename Identifiers — Variables and functions become random garbage names like
_x3f9
- 🔒 Encode Strings —
"hello" becomes "\x68\x65\x6c\x6c\x6f"
- 🗑️ Strip Comments — All comments and docstrings removed
- 📦 Compress Whitespace — Blank lines eliminated
- 📁 Folder Support — Obfuscate entire projects at once
- ⚙️ Configurable — Toggle each technique on/off in Settings
How to Use
Single File
Right-click any .py file → PyVault: Obfuscate Python File
Entire Folder
Right-click any folder → PyVault: Obfuscate All Python Files in Folder
Output
A new file is created alongside the original:
myfile.py → myfile_obfuscated.py
Settings
Open VS Code Settings and search for PyVault:
| Setting |
Default |
Description |
pyvault.renameIdentifiers |
true |
Rename variables/functions |
pyvault.encodeStrings |
true |
Hex-encode string literals |
pyvault.stripComments |
true |
Remove comments/docstrings |
pyvault.compressWhitespace |
true |
Remove blank lines |
pyvault.outputSuffix |
_obfuscated |
Output filename suffix |
Example
Before:
# Calculate discount
def calculate_discount(price, tier):
if tier == "premium":
return price * 0.80
return price * 0.95
After:
# Protected by PyVault
def _x3f9(_b2a1, _k7e2):
if _k7e2 == "\x70\x72\x65\x6d\x69\x75\x6d":
return _b2a1 * 0.80
return _b2a1 * 0.95
Important Note
Obfuscation is not encryption. A determined reverse engineer with enough time can still decode obfuscated code. PyVault significantly raises the difficulty — it does not make it impossible.
License
MIT
Made by Kashish Ahuja