Semantic Designs can construct custom obfuscators for virtually any source language. Here we illustrate with a sample C code.
A Simple Obfuscation Example
The C source code for a simple bcd/double converter may be found in
The code includes a main program test driver. In addition to several standard libraries, the example includes some user libraries as .h files:
Standard library files need not be obfuscated.
The example source is obfuscated along with these libraries to produce the
obfuscated files:
Notice that comments are gone, names have been scrambled, and text strings and character literals are obscured with partial replacement of characters by their character codes. Larger numeric constants have their radix twiddled.
We invite you to compile and run both the original and the obfuscated codes with either gcc or Microsoft Visual C 6.0 to see that the results of the execution are identical.
Reserved Symbol List
The obfuscator uses special lists provided by the user to define names that should be preserved, ensuring that public interfaces and accesses to public libraries remain valid. If you obfuscate a set of C source files simultaneously, only the public symbols they collectively offer will be visible in the compiled source files. An SD-supplied list covers standard C system and library calls.
alloc_text auto_inline bss_seg check_stack code_seg comment component ### list elided ### ... main wmain FLT_DIG DBL_DIG LDBL_DIG ... _exit _flushlbf _tolower _toupper a64l abort abs accept access ...
Obfuscated Symbol Cross Reference
The obfuscator produces a cross reference mapping obfuscated symbols to the orginal symbols, so that obfuscated code in the field can still be decoded if necessary. In fact, by reversing this map, the obfuscator can unobfuscate the identifiers in the code. (Of course, it cannot restore the comments, nor would it revert strings or literals to their original representation.)
### Obfuscated Identifiers ### BCDNum -> O101000000011 BCDtoLong -> O101000000010 BYTE -> O101001000100 Boolean_T -> l101000111110 Error_ -> O101000111010 FREE -> l101001010000 False_ -> l101000111100 HUGE -> l101001001011 IEEEToMSBIN -> O101000100101 INC_OLE1 -> O101001001001 INC_OLE2 -> l101001001010 INV_PHI -> O101000101111 LAST_CHAR -> O101001001101 LongtoBCD -> l101000000100 MSBINToIEEE -> l101000100011 N -> O101000011000 NOGDI -> l101001000111 NOSERVICE -> l101001001000 NUL -> O101001001100 OS2 -> l101001000011 PHI -> l101000101110 PI__H -> l101000111000 ROUND__H -> O101000110100 SNIPMATH__H -> l100111111111 SNIPTYPE__H -> l101000111001 SetBCDLen -> O101000000000 SolveCubic -> O101000001001 Success_ -> l101000111011 TEST -> l100111100110 TEST_T -> O100111111010 TOBOOL -> O101001001111 True_ -> O101000111101 WIN32 -> l101000111111 WIN32_LEAN_AND_MEAN -> l101001000110 WORD -> O101001000101 _WIN32 -> O101001000000 _WINDOWS -> l101001000010 __NT__ -> l101001000001 __cplusplus -> l101000110101 a -> O101000001010 arg -> O100111110001 b -> O101000001011 bcd_to_double -> l100111100111 buf -> l100111101000 buffer -> O100111101100 c -> O101000001100 d -> l101000001101 dbl2long -> l101000010010 dbl2ulong -> O101000010000 deg -> l101000101101 deg2rad -> O101000101100 digits -> l100111101010 dmax -> l101000100000 double_to_bcd -> O100111110000 dround -> l101000010011 expect -> l100111111001 f -> O101000100100 fibo -> l101000011001 format -> O100111110100 frac -> O101000110001 frandom -> l101000011011 fround -> O101000110111 high -> O100111101101 initlogscale -> O101000011111 int_sqrt -> O101000110000 ipow -> l101000011100 iround -> l101000110110 ispow2 -> l101000011101 ldfloor -> l101000011110 len -> l100111101001 length -> l100111110010 log10C -> O101000010111 log10P -> l101000010100 log10factorial -> O101000010110 logscale -> l101000100010 low -> l100111101110 m -> O101000000111 max -> O100111101111 n -> O101000000001 ncomb1 -> O101000000110 ncomb2 -> O101000001000 negative -> l100111110111 num -> O101000000101 p -> O101001010001 perm_index -> l101000100110 pit -> l101000100111 q -> O101000110011 r -> l101000010101 rad -> O101000101011 rad2deg -> O101000101010 rc -> O100111111100 rmax -> l101000100001 round_div -> O101000101000 round_ldiv -> l101000101001 rv -> O100111101011 s -> O101001001110 size -> O100111111101 solutions -> l101000001110 t -> l101000010001 term -> O101000011010 testvals -> O100111111110 usqrt -> O101000110010 value -> O100111111000 wrkbf -> O100111111011 wrkbuf -> O100111110011 x -> l101000001111 x_sub -> l100111110110 y_sub -> l100111110101 ### Preserved Identifiers ### ABDAY_1 -> ABDAY_1 ABDAY_2 -> ABDAY_2 ABDAY_3 -> ABDAY_3 ABDAY_4 -> ABDAY_4 ABDAY_5 -> ABDAY_5 ABDAY_6 -> ABDAY_6 ABDAY_7 -> ABDAY_7 ### list elided ### ... _wenviron -> _wenviron _wgetenv -> _wgetenv _wputenv -> _wputenv _wsetargv -> _wsetargv a64l -> a64l abort -> abort abs -> abs accept -> accept access -> access ...