Comment by 🐝 undefined

Re: "Obfuscating C"
In: u/LucasMW

Btw renaming global symbols would make most projects not compilable anyway since they're expected to have the names they have for linking, both static and dynamic :)

🐝 undefined

May 07 · 7 months ago

9 Later Comments ↓

🚀 LucasMW [OP] · 2025-05-07 at 06:32:

@undefined. Thanks, I will check this stb parser, to see if it fits my needs.

🚀 LucasMW [OP] · 2025-05-07 at 06:33:

@stack just imagine you can keep a map of the original to renamed symbols elsewhere and can obfuscate and deobfuscate easyly at will.

🚀 jsreed5 · 2025-05-07 at 14:32:

I don't have a solution to recommend, but I'm reminded of how Swift allows programmers to use emoji as variable names. https://www.globalnerdy.com/wordpress/wp-content/uploads/2014/06/poopy-swift-code-example.jpg

🚀 stack · 2025-05-07 at 17:25:

I understand, but I cannot imagine why anyone would expose source unless it was the intent! If you are hiding the secret part that makes it readable, why not hide the actual source file itself!

The only (awful) case I can imagine is if you are contractually obligated to deliver compilable sources but want to screw the other party ...

🦂 zzo38 · 2025-05-07 at 17:47:

Maybe it can be useful if the names interfere with other files or are not valid on one computer, they can be automatically changed to names that do not interfere and are valid. However, it may be necessary to do this across multiple source files. (In some cases, it may make more sense to change the names after the file is compiled.)

🚀 stack · 2025-05-07 at 22:34:

As a bonus, try to use similar-looking unpronounceable symbols and make sure to use same names for locals, globals, and function names, as much as possible

Mixing I and 1, and O and 0 is good. Or use Unicode look-alike glyphs

Or better yet just post some junk code and really confuse them, whoever they are

👻 darkghost · 2025-05-07 at 23:02:

Isn't abuse of goto making the worst spaghetti code possible another form of obfuscation? Combined with similar looking labels like above.

🚀 stack · 2025-05-08 at 00:59:

Automatically create a slew of loops and conditionals using bullshit variables initialized elsewhere, in such a way that they will get optimized out.

🐙 norayr · 2025-05-13 at 20:36:
— isn't c code obfuscated enough already?

Original Post

🚀 LucasMW

Obfuscating C — I am working on a code obfuscator. Basically the idea is to rename every symbol in the program to another name, thus destroyng information. The idea is also customization of the generated names according to wordlists and rulesets (for example, one pokémon themed) I already have some kind of proof of concept: For example, this small program: [preformatted] I wish there was some shortcuts. Does anyone knows an easy way of given a source file, to extract a list of all variable...

💬 18 comments · May 06 · 7 months ago · #coding #programming #software