SmileBASIC Obfuscator

DescriptionThis application compresses SmileBASIC code, removes comments, newlines, spacing, renames variables, functions, and labels, compresses numbers. It moves strings and numbers into a compact data section, then masks these values to constants that are accessed in array indexing.
It provides automatic code editing, line indentation, formatting numbers, string, and spacing properly, or just minify and compact everything. Currently, there are a few options that the user can choose from, but this application is currently undergoing major development to support many more options with a user friendly UI in the future. This current version is stable and provides high quality code automation.
The discussion forum can be found at:
http://smilebasicsource.com/forum?ftid=1659
Cheers!InstructionsCurrently, there are eight boolean options that the obfuscator provides:

Minify or semi-beautify the code

Keep or remove comments

Rename labels

Rename variables

Rename functions

Assign variables to non-variable values such as strings and numbers

Mask numbers and indexes with constants and hexadecimal representations

Search strings for variable names, function names, and labels, which will be renamed as well

By saying "Yes" to every question, the code will become compact and unreadable, yet executable. Future updates will expand the code beautification capabilities and provide a lot more customization than the eight yes/no options that are currently present.
The file will be saved as the original name of the program with "OBF_" added to the front.
(The obfuscated code can also be found in PRG1)
It will then attempt to execute the program.

Enjoy!

37 Comment(s)IAmRalseiForum LeaderHiddenAchievementsFirst YearMy account is over 1 year oldWebsiteExpert ProgrammerProgramming no longer gives me any trouble. Come to me for help, if you like!Programming Strength2 months agoSmileBASIC Deobfuscator. Coming 2019 to a 3DS near you.
Official DevlogTheV360Pokemon Is Awesome!I love Pokemon!Express YourselfFirst DayJoined on the very first day of SmileBASIC SourceWebsiteNight PersonI like the quiet night and sleep late.Express Yourself2 months agoHeck yeah, now I can deobfuscate the... [checks notes] zero programs using thisIAmRalseiForum LeaderHiddenAchievementsFirst YearMy account is over 1 year oldWebsiteExpert ProgrammerProgramming no longer gives me any trouble. Come to me for help, if you like!Programming StrengthEdited 2 months agoThis program was obfuscated probably using itselfHTV04Intermediate ProgrammerI can make programs, but I still have trouble here and there. Programming StrengthAvatar TabooI didn't change my avatar for 180 daysWebsiteForum ContributorHiddenAchievements6 months agoThis is pretty cool! I can understand why some people are upset, but when used in the right ways, this can be used as a way to hide secret code (such as code for puzzles).bananaRNGHiddenEaster EggsDisguisedHiddenWebsiteExpert ProgrammerProgramming no longer gives me any trouble. Come to me for help, if you like!Programming Strength11 months agoI actually don't understand why there is too much hate...
I like the idea.spaceturtlesVideo GamesI like to play video games!HobbiesAvatar BlockI didn't change my avatar for 30 days.WebsiteIntermediate ProgrammerI can make programs, but I still have trouble here and there. Programming Strength11 months agoThe posts below and the related thread gives a general idea or two.SimeonScholarReceived for knowing a great deal about programming topicsAchievementsAmazing PageHiddenAchievementsDrawingI like to draw!Hobbies11 months agoWow that is a lot of opinions...
I don't like arguing can I not be on anybody's bad side? Lol
Well I'm going to turn this into a highly customizable, automatic code editor
** Which will include beautifying code too **
But the purpose of this was to support the idea of complete consistency of code, and I can achieve that really easily now. So, after some updates I'll end up renaming this to something that doesn't sound as threatening. Sorry for that.
Cause it'll be a tool to edit code however the user wants. To save time doing it manually.
Not to focus purely on hiding things! (But I want that to be an option)
It's worth noting that this would be easy to apply only to specific functions.
My goal is to give the users more power over THEIR code, that's all.
Before submitting this, manually obfuscating programs was praised. Why does automating it suddently change everyone's opinions?kenchicFirst YearMy account is over 1 year oldWebsiteBeginner ProgrammerI'm just starting out! I'm still trying to grasp the basics.Programming Strengthosu! Is Awesome!I love osu!Express Yourself11 months agoManually obfuscating something means that you would put the effort into making it unreadable, making you think twice about it.
Automation removes that barrier, allowing anyone with the knowledge of how to operate your obfuscator to ruin their code for everyone else. :(SmileForTheKiddiesEdited 11 months agoAlso line 325 gives me an out of memory error12Me21Head AdminThird YearMy account is over 3 years oldWebsiteSyntax HighlighterReceived for creating the code syntax highlighter on SBSNight PersonI like the quiet night and sleep late.Express Yourself11 months agoI don't remember anyone ever praising manual obfuscation.kenchicFirst YearMy account is over 1 year oldWebsiteBeginner ProgrammerI'm just starting out! I'm still trying to grasp the basics.Programming Strengthosu! Is Awesome!I love osu!Express Yourself11 months agoHe's referring to that one puzzle thing where no one knew what did whatMochaProbablyExpert ProgrammerProgramming no longer gives me any trouble. Come to me for help, if you like!Programming StrengthNight PersonI like the quiet night and sleep late.Express YourselfDrawingI like to draw!Hobbies11 months agoThe thing Nathaniel did?TheV360Pokemon Is Awesome!I love Pokemon!Express YourselfFirst DayJoined on the very first day of SmileBASIC SourceWebsiteNight PersonI like the quiet night and sleep late.Express Yourself11 months agoI don't really get the criticism of this... It's just a small experimental program that has a bunch of uses outside scrambling your code around.
You could, for example, use this on a small part of your code just to hide the checksum algorithm for your save files, or the puzzle solution in a game.
If someone actually uses this on their entire program, obscuring the most useful and repurposable functions, then that's bad.
also i just think it's a bit rude to downvote someone's program without trying it...IAmRalseiForum LeaderHiddenAchievementsFirst YearMy account is over 1 year oldWebsiteExpert ProgrammerProgramming no longer gives me any trouble. Come to me for help, if you like!Programming Strength11 months agoi never thought of using it this way...Y_ackHead Admin11 months agoI would find your comment agreeable and applicable, if not for two things:
The creator suggested an intent to protect code in whole and really only suggested the cheating motive later, stating

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

and suggesting that "SmileBASIC may be less beginner friendly" is some sort of minor inconvenience. This troubles me. If obfuscating SmileBASIC programs becomes the norm I think the community will suffer for it. Even if people cheat--so what? Either they're learning by working with someone else's code, or they're just ruining the fun for themselves.
I don't think the tool should be removed entirely: its existence does not invent obfuscation. Any sufficiently knowledgeable programmer could do so manually as needed. It may not even cause its proliferation. But there is something to be said for its existence towards the encouragement of such practices, if no one speaks against it. I would retract my vote, but at this point contention has played out on the vote system and I don't think there is much point.MochaProbablyExpert ProgrammerProgramming no longer gives me any trouble. Come to me for help, if you like!Programming StrengthNight PersonI like the quiet night and sleep late.Express YourselfDrawingI like to draw!HobbiesEdited 11 months ago”Hmm, what would be the best way for people to look at my stuff and say “Hey, what the hell is this?” Oh yeah, change very function to random lengths of _ and scatter random number throughout”.kantackistan11 months agoNeat! Can't wait to play around with this.
Probably won't start obfuscating everything, but I love hiding secrets for only the most determined of players to find.randomousOwnerRobotHiddenEaster EggsSecond YearMy account is over 2 years oldWebsiteDrawingI like to draw!Hobbies11 months agoMost of the programs I've made use VAR("THING") and CALL("WHATEVER"), and considering how useful it is, I'd say many of the more complex programs for which your program would be beneficial (like for anti-cheating) would fail.
But I get why it's difficult. You COULD do a heuristic to capture the common use cases for VAR and CALL, and if a program STILL doesn't work well then they're doing something crazy.
For instance, you could search for all string literals and if they match an existing function or variable name (that you've obfuscated), you can replace the literal. This will fix both CALL("MYFUNC") and CALL(THING$) where THING$ is set to a literal SOMEWHERE.SimeonScholarReceived for knowing a great deal about programming topicsAchievementsAmazing PageHiddenAchievementsDrawingI like to draw!Hobbies11 months agoWill do!
Good idearandomousOwnerRobotHiddenEaster EggsSecond YearMy account is over 2 years oldWebsiteDrawingI like to draw!HobbiesEdited 11 months agoKeep in mind that if the string is prefaced by a number and a colon, you have to keep the number/colon combo. For instance:
VAR("AVARIABLE") -> VAR("OBFA")
VAR("3:AVARIABLE") -> VAR("3:OBFA")
So you must check both that a literal matches the exact name and also that the string matches [n]:<string>, and only replace the name portion.kenchicFirst YearMy account is over 1 year oldWebsiteBeginner ProgrammerI'm just starting out! I'm still trying to grasp the basics.Programming Strengthosu! Is Awesome!I love osu!Express Yourself11 months agoThe point of an open-source platform is to allow others to read and eventually understand others' programs.
Y_ackHead Admin11 months agocommenting on the page increases rank. this debate goes here: https://smilebasicsource.com/forum?ftid=1659SimeonScholarReceived for knowing a great deal about programming topicsAchievementsAmazing PageHiddenAchievementsDrawingI like to draw!Hobbies11 months agoWhy the dislikes?IAmRalseiForum LeaderHiddenAchievementsFirst YearMy account is over 1 year oldWebsiteExpert ProgrammerProgramming no longer gives me any trouble. Come to me for help, if you like!Programming Strength11 months agothe fact an obfuscator exists is a problem in the first placeSimeonScholarReceived for knowing a great deal about programming topicsAchievementsAmazing PageHiddenAchievementsDrawingI like to draw!Hobbies11 months agoHow is that a bad thingspaceturtlesVideo GamesI like to play video games!HobbiesAvatar BlockI didn't change my avatar for 30 days.WebsiteIntermediate ProgrammerI can make programs, but I still have trouble here and there. Programming StrengthEdited 11 months agoOnly Toad would see non-editable and understandable code as a problem since Toad probably wants to view how a program works against an uploader's wishes.
I'm guessing it's the quality of the obfuscation that people don't like or we have a Toad army.Y_ackHead Admin11 months agoI downvoted this program based on the principles established in the discussion thread. Regardless of its quality, an obfuscator does not deserve widespread use or the same level of prestige as other development tools and libraries.
Similarly, I downvoted Amihart's challenge after my solution not because of its quality but in an attempt to discourage mindless clones.spaceturtlesVideo GamesI like to play video games!HobbiesAvatar BlockI didn't change my avatar for 30 days.WebsiteIntermediate ProgrammerI can make programs, but I still have trouble here and there. Programming Strength11 months agoOh okay that makes sense.IAmRalseiForum LeaderHiddenAchievementsFirst YearMy account is over 1 year oldWebsiteExpert ProgrammerProgramming no longer gives me any trouble. Come to me for help, if you like!Programming Strength11 months agoChicken also has a problem with it
to quote the higher up comment, "The point of an open-source platform is to allow others to read and eventually understand others' programs."amihart11 months agoPeople salty over the existence of an obfuscator because they want "free code", when they don't realize that trying to suppress the existence of an obfuscator is antithetical to that very concept. amihart11 months agoInteresting.
You should probably have a "WHILE BUTTON()!=0:WEND" at the beginning, because pressing A just to start the program causes it to also press A on the first option which is a bit annoying. spaceturtlesVideo GamesI like to play video games!HobbiesAvatar BlockI didn't change my avatar for 30 days.WebsiteIntermediate ProgrammerI can make programs, but I still have trouble here and there. Programming Strength11 months agoWhat about using an "on button release" for that? Or is bounce an issue?SimeonScholarReceived for knowing a great deal about programming topicsAchievementsAmazing PageHiddenAchievementsDrawingI like to draw!Hobbies11 months agoFixed, thanks!12Me21Head AdminThird YearMy account is over 3 years oldWebsiteSyntax HighlighterReceived for creating the code syntax highlighter on SBSNight PersonI like the quiet night and sleep late.Express Yourself11 months agoIt might be a good idea not to obfuscate COMMON functions since they'll probably be used in another slot.SimeonScholarReceived for knowing a great deal about programming topicsAchievementsAmazing PageHiddenAchievementsDrawingI like to draw!Hobbies11 months agoWell, from my knowledge, then the COMMON functions would completely not work if it uses global variables. I need to do more testing
My solution right now is just to combine everything into one file before obfuscation
If I find a better solution I will definitely attempt it
Maybe automatically combining all the needed files then separate them and save each one12Me21Head AdminThird YearMy account is over 3 years oldWebsiteSyntax HighlighterReceived for creating the code syntax highlighter on SBSNight PersonI like the quiet night and sleep late.Express Yourself11 months agoOh, I meant to say specifically the function name.SimeonScholarReceived for knowing a great deal about programming topicsAchievementsAmazing PageHiddenAchievementsDrawingI like to draw!Hobbies11 months agoIf you get an error other than "Out of memory" then you may be trying to obfuscate variables, functions, or labels in a program that uses CHKVAR(), CHKCALL(), or CHKLABEL().
If this is not the case, it would be very nice if you could send the un-obfuscated program to me so that I can find the cause.
CHK functions cannot be worked around without completely re-implementing the CHK function code. This uses the same principles of the halting problem, CHK function strings cannot be obfuscated without evaluating the expression, which leads to broader issues...Load: 114msPrivacyAbout