Does anyone have experience with making an obfuscator?
I'd like to try making one, because if successful, people would be able to compress and rename all variables and functions in their code automatically, and make it nearly impossible to understand
This would be a really nice program for SmileBASIC
My thoughts on how it might get done:
- Tokenize everything into an array
- Find the beginning and end of every scope (functions)
- In the global scope, detect every variable name and assign it a new name (a,b,c,...,aa,ab,ac,...,ba,bb,bc,...) (This will be done by converting from base-10 to base-26)
- Then go through each scope and continue finding variable names, but this time undo everything upon leaving the scope
- Keep track of every index of every variable name replacing at the end, or replace as we go?