DosX-dev/obfus.h logo

DosX-dev/obfus.h

Free

Macro-header for compile-time C obfuscation (tcc, win x86/x64)

FreeFree tier
Type
Open Source
Company
DosX-dev

About DosX-dev/obfus.h

obfus.h is a macro-only library for compile-time obfuscation of C applications, designed specifically for the Tiny C Compiler (tcc) on Windows x86 and x64 platforms. It provides multiple layers of protection including function call obfuscation, anti-debugging, control flow mutation, string hiding, anti-decompilation, fake signature insertion, and math operation virtualization. The library is integrated by simply including a single header file, and offers configurable options to enable or disable specific features.

Key Features

Function Call Obfuscation: Confuses function calls to reduce readability
Anti-Debugging Techniques: Built-in mechanisms to prevent runtime code analysis
Control Flow Code Mutation: Obfuscates conditions and loops into spaghetti code
Strings Hiding: Hides strings by assembling them on the stack via mov instructions
Anti-Decompilation Techniques: Visually breaks output of popular decompilers
Fake Signatures Adding: Adds fake signatures of packers/protectors to confuse reverse engineers
Math Virtualization: Obfuscates math operations using virtual machine commands
Configurable protection options via #define macros (e.g., VIRT, CFLOW_V2, ANTIDEBUG_V2, FAKE_SIGNS)
Can disable default features (NO_OBF, NO_CFLOW, NO_ANTIDEBUG) for debugging

Pros & Cons

Pros
  • Compile-time obfuscation adds no runtime overhead once compiled
  • Macro-only library requires only a single #include line
  • Simple configuration via #define macros allows per-project tuning
  • Supports both x86 and x64 Windows targets
  • Includes multiple obfuscation techniques in one lightweight header
  • Free and open source under a permissive license
Cons
  • Limited to Tiny C Compiler (tcc) on Windows; no support for GCC, Clang, or other platforms
  • Enabling certain features (e.g., CFLOW_V2) can significantly slow compilation
  • Requires suppressing compiler warnings (-w) to avoid numerous logs
  • Some features (like ANTI_DEBUG) rely on MSVCRT functions, which may limit portability
  • Not suitable for hiding static fields during declaration (string hiding uses function call)

Best For

Protecting intellectual property in C applications compiled with Tiny C CompilerObfuscating code to deter reverse engineering and unauthorized analysisAdding anti-tamper and anti-debugging layers to Windows x86/x64 executablesHiding sensitive strings (e.g., API keys, license keys) from static analysis

FAQ

How do I integrate obfus.h into my project?
Simply include the header with `#include "obfus.h"` in your C source code. The obfuscation happens automatically during compilation.
Can I disable certain obfuscation features?
Yes, by defining macros like `NO_OBF`, `NO_CFLOW`, or `NO_ANTIDEBUG` before including the header, or via compiler arguments like `-D NO_CFLOW`.
Why does my console show many warnings when compiling?
obfus.h generates numerous expected warnings. Pass the `-w` argument to tcc to suppress them; the warnings have no impact on the final output.