Code Naming convention
To ensure detection by Codefend's parser, it is necessary for the words that need to be obfuscated to follow this format:
The word must include an underscore _
positioned in the middle.
Example
You have the flexibility to use either camelCase or PascalCase, and both are acceptable. However, it's important to follow the specified naming convention in addition to the chosen case style:
MyVariable
->l_MyVariable
myVariable
->l_myVariable
------------------------------ Before Obfuscation ------------------------------
class l_Calculator {
l_sum(l_firstNumber, l_secondNumber) {
const l_results = l_firstNumber + l_secondNumber;
return l_results;
}
}
------------------------------ After Obfuscation ------------------------------
class Ox0 {
Ox1(Ox2, Ox3) {
const Ox4 = Ox2 + Ox3;
return Ox4;
}
}
This naming convention can also be applied inside HTML, CSS, and JS files or even React, Vue, Angular, and Svelte components... Here's another example:
------------------------------ Before Obfuscation ------------------------------
<html>
<head>
<style>
.l_red {
color: red;
}
</style>
</head>
<body>
<div class="l_red">l_secret</div>
<div class="l_red">Hello World</div>
</body>
</html>
------------------------------ After Obfuscation ------------------------------
<html>
<head>
<style>
.Ox1 {
color: red;
}
</style>
</head>
<body>
<div class="Ox1">Ox0</div>
<div class="Ox1">Hello World</div>
</body>
</html>
Structured naming convention optional
Given that the underscore should be in the middle of the word, an alternative option is to adopt a more structured naming convention, which can enhance the organization of your code:
- Class names: Begin with "c_" followed by the descriptive name.
- Example:
c_UserManager
,c_DataProcessor
,c_Logger
- Example:
- Function names: Begin with "f_" followed by the descriptive name.
- Example:
f_getUserData
,f_calculateTotal
,f_validateInput
- Example:
- Parameter names: Begin with "p_" followed by the descriptive name.
- Example:
function doSomething(p_inputData) { ... }
- Example:
function processUserData(p_userInfo) { ... }
- Example:
- Local variable names: Begin with "l_" followed by the descriptive name.
- Example:
function calculateSum() { let l_totalSum = 0; ... }
- Example:
function processArray() { let l_index = 0; ... }
- Example:
By following this convention, you can easily identify the purpose and scope of different elements in your code. The underscore in the middle of the word, along with the specified prefixes, will provide a clear and consistent naming pattern, contributing to code readability and maintainability.
------------------------------ Before Obfuscation ------------------------------
class c_Calculator {
f_sum(p_firstNumber, p_secondNumber) {
const l_results = p_firstNumber + p_secondNumber;
return l_results;
}
}
------------------------------ After Obfuscation ------------------------------
class Ox0 {
Ox1(Ox2, Ox3) {
const Ox4 = Ox2 + Ox3;
return Ox4;
}
}
This is the only rule and the only requirement that Codefend needs from you as a programmer. Simply ensure that the words you want to be obfuscated contain an underscore _
in the middle, following the specified format, and Codefend will handle the rest of the obfuscation process seamlessly for any code written in any language.