Nowadays, malicious programmers are utilizing modern technologies to bypass licensing and anti-copying mechanisms which can hit your revenue. It’s also common for hackers to try to breach steps you might have taken to protect and encrypt sensitive user data to steal it, possibly for nefarious purposes such as identity theft or blackmail. Breaches such as these can cause major financial damage to development teams and companies.
If you are a C++ developer, one method to help protect your C++ applications built with C++ software is to use a technique known as code obfuscation. In the event that malicious programmers attempt to reverse engineer your code, it can make your code very difficult for them to understand. In this post, you will find all the details.
Table of Contents
What is a C++ Code Obfuscator?
C++ Code Obfuscator is a tool that scrambles C++ code to make it very difficult to understand. As a result, the hackers face a tough time stealing valuable information from your program. Also, it prevents your competitors from reverse-engineering your code. It provides significant protection for C++ source code and intellectual property.
Why should you use C++ Code Obfuscator?
- Makes your program hard to understand by generating an extra layer of obfuscation to achieve complexity
- Hides important information by generating constant values randomly
- Preserves intellectual property by obfuscating the source code
What is the best C++ Code Obfuscator in 2021?
As far as I am concerned, CodeMorph C/C++ Code Obfuscator is a great solution for protecting your source code in 2021. It randomly generates and inserts assembly ‘junk’ instructions as inline and macro code into your program. As a result, your C++ source code becomes very difficult to comprehend.
How the CodeMorph C++ Code Obfuscator Protects Your Source Code
CodeMorph C++ Code Obfuscator protects your source code by adding an extra layer of obfuscation. As a result, your program will become too complex to understand. So, the malicious programmers will go through a tough time in altering your code.
How do I download the CodeMorph Code Obfuscator?
You can go to the following link: http://www.sourceformat.com/code-obfuscator-cpp.htm – they also do a version on the same site which can obfuscate Delphi code to protect it from hackers and reverse-engineering too (you can read the Delphi article here).
Let’s take a look at an example.
Here is the source code before obfuscation:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
void read_data(void *data, int bits_of_data, unsigned char *bit_stream, unsigned long &bit_offset) { int i; int n; while (bits_of_data > 0) { n = bits_of_data > 8 ? 8 : bits_of_data; *(unsigned char*)data = 0; for (i = 0; i < n; i++) { if (read_bit(bit_stream, bit_offset)) { (*(unsigned char*)data) |= (1 << i); } bit_offset++; } data = ((unsigned char*)data) + 1; bits_of_data -= n; } } |
As you can see, the code is very easy to understand. There are several if-else statements, along with a simple for loop. Your competitors can easily reverse-engineer this code to gain a competitive advantage. However, if you use the CodeMorph C++ Code Obfuscator, everything becomes quite complex. Let’s take a look at the obfuscated code.
Here is the source code after obfuscation:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
void read_data(void *data, int bits_of_data, unsigned char *bit_stream, unsigned long &bit_offset) { // junk instruction begin __asm { jz _P01 jnz _P01 _emit 0e8h _P01: } // junk instruction end int i; // junk instruction begin __asm { jz _P01 jnz _P01 _emit 0e9h _P01: } // junk instruction end int n; // junk instruction begin __asm { clc jnb _P01 _emit 0e8h _emit 0e8h _P01: } // junk instruction end while (bits_of_data > 0) { // junk instruction begin __asm { jz _P01 jnz _P01 _emit 09ah _emit 0e8h _P01: } // junk instruction end n = bits_of_data > 8 ? 8 : bits_of_data; // junk instruction begin __asm { clc jnb _P01 _emit 0e8h _emit $e8h _P01: } // junk instruction end *(unsigned char*)data = 0; // junk instruction begin __asm { jl _P01 _P02: jmp _P03 _emit 0e8h _P01: jz _P02 _P03: } // junk instruction end for (i = 0; i < n; i++) { if (read_bit(bit_stream, bit_offset)) { (*(unsigned char*)data) |= (1 << i); } // junk instruction begin __asm { jle _P01 jg _P01 _emit 0e8h _P01: } // junk instruction end bit_offset++; } // junk instruction begin __asm { clc jnb _P01 _emit 0e8h _emit 0e8h _P01: } // junk instruction end data = ((unsigned char*)data) + 1; // junk instruction begin __asm { jc _P01 jnc _P01 _emit 0e8h _P01: } // junk instruction end bits_of_data -= n; // junk instruction begin __asm { jz _P01 jnz _P01 _emit 0e8h _P01: } // junk instruction end } } |
As you can see, CodeMorph C++ Code Obfuscator has inserted junk instructions into the source code. It has hidden the execution logic of the program. As a result, the whole structure has been changed. It will be very difficult for malicious programmers to modify the source code. In this way, CodeMorph C++ Code Obfuscator helps you to protect your intellectual property from hackers.
Should I use CodeMorph C++ Code Obfuscator?
C++ Code Obfuscator makes your program harder to read by adding randomly generated junk codes. If you want to prevent malicious programmers from reverse engineering your code and steal valuable information from your program, you should definitely consider using it.
Why not download a trial copy of RAD Studio today and try the example for yourself?
Design. Code. Compile. Deploy.
Start Free Trial Upgrade Today
Free Delphi Community Edition Free C++Builder Community Edition