Obfuscating C++ Code
Semantic Designs can construct custom obfuscators for virtually any source language as a part of the corresponding Source Formatter. This page contains C++ sample code, its obfuscated version, and the generated obfuscation map.
C++ Sample Code before Obfuscation
The unobfuscated source code for a public-domain templated AVL tree module
can be seen at:
avl_tree.h,
avl_ex1.cpp,
avl_ex2.cpp, and
test_avl.cpp.
This set of programs compiles and runs on standard ANSI C++ compilers.
C++ Code after Obfuscation
The obfuscated source code for the above files can be found in:
obfuscated_avl_tree.h,
obfuscated_avl_ex1.cpp,
obfuscated_avl_ex2.cpp, and
obfuscated_test_avl.cpp.
(We invite you to download and compile this obfuscated version of the program
to demonstrate that it still works beautifully.)
Notice that comments are gone and names have been scrambled. 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 as we have with these, 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.
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 code (of course, it cannot restore the comments).
### Obfuscated Identifiers ### ABSTRACT_CONTAINER_AVL_TREE_H_ -> l110010100110 ABSTRACT_CONTAINER_SEARCH_TYPE_ -> O110010100111 EQUAL -> l110010101001 GREATER -> O110010101011 GREATER_EQUAL -> O110010101101 HIGH_BIT -> l110011100011 LESS -> O110010101010 LESS_EQUAL -> O110010101100 MASK_HIGH_BIT -> O110010111001 abstr -> l110001111001 abstract_container -> l110010001100 abstractor -> O110010101110 all_trees -> O110100000010 arr -> l110011100101 arr2 -> O110011100110 avl_tree -> O110010001101 bail -> O110011100001 bal_h -> O110011010001 balance -> l110011010000 base_avl_tree -> l110010110001 bf -> l110010000100 big_test -> O110011110101 branch -> l110011000001 bset -> l110010110000 build -> O110011000110 build_test -> O110100000100 check_empty -> l110011101101 child -> O110011001011 cmp -> l110010111011 cmp_k_n -> l110010111110 cmp_n_n -> l110011000100 cmp_shortened_sub_with_path -> l110011011100 cnt -> O110010011010 cnt_list -> O110010100011 compare_key_key -> l110010011100 compare_key_node -> l110010000101 compare_node_node -> l110010000111 d -> O110010111101 deep_h -> O110011010010 depth -> O110010110111 depth_ -> O110011111001 dump -> l110010010001 e -> O110010010110 env -> O110001110110 fwd_iter -> l110011000101 g_depth -> l110011101100 get_balance_factor -> l110010000010 get_bf -> l110011001111 get_greater -> l110001111111 get_gt -> O110011000000 get_less -> l110001111100 get_lt -> O110010111111 get_node -> l110010011111 gh -> O110010000001 gt -> l110001111000 h1 -> l110010001000 h2 -> O110010001001 h_arr -> O110100000011 handle -> l110001111010 hh -> O110011011000 i -> l110010100101 in_step -> l110011110110 ip_addr -> l110010011001 ip_addr_cnt -> O110010010111 ip_addr_list -> O110010100010 is_empty -> l110010110110 it -> l110010010011 it2 -> O110011110011 iter -> O110010010010 k -> O110010000110 k1 -> O110010011101 k2 -> l110010011110 key -> O110001111011 l_depth -> l110011101011 less_parent -> l110011001010 lh -> O110001111110 mark_bf -> l110011110001 match_h -> l110011011010 max_depth -> l110010101111 max_elems -> l110011110000 n -> l110010010000 next -> l110011111110 node -> O110001110111 node_t -> l110010011000 note -> l110011100010 null -> l110010001010 num_addr -> l110010100100 num_nodes -> l110011000111 num_nodes_used -> l110010011011 num_sub -> l110011001001 old_h -> l110011010011 one_tree -> O110100000001 p -> l110010100001 parent -> l110011011001 parent_rm -> l110011011110 parent_unbal -> l110011010101 path -> O110011011111 path_h -> O110011000010 place -> O110011111111 possible_trees -> O110011111000 pt -> O110100000000 pub_root -> O110011101000 purge -> O110010010101 read_error -> l110010001011 reduced_depth -> O110011100000 rem -> O110011001000 rh -> l110011101110 rm -> O110011011101 rm_depth -> l110011011011 rm_step -> l110011110111 root -> l110010110101 s -> O110011111100 s2 -> l110011111101 search_all -> O110011110100 search_greatest -> l110010110100 search_least -> l110010110011 search_test -> l110011110010 search_type -> l110010101000 see -> l110010100000 set_balance_factor -> O110010000011 set_bf -> l110011001110 set_greater -> l110010000000 set_gt -> O110011001101 set_less -> l110001111101 set_lt -> O110011001100 should_be_null -> O110011101111 st -> O110010110010 start_iter -> l110010111000 start_iter_greatest -> O110011000011 start_iter_least -> O110010010100 sub -> l110011111010 subroot -> l110011101010 t -> O110011111011 t_avl_tree -> l110011100111 target_cmp -> l110010111100 tree -> O110010001111 tree_ -> O110010111010 tree_t -> O110010001110 unbal -> O110011010100 unbal_bf -> O110011010110 unbal_depth -> O110011010111 val -> O110011100100 verify_tree -> l110011101001