function urlEncode(str) {
function urlEncode(str) {
function base64Encode(str) {
// Converts the string to Base64 format
try {
return btoa(unescape(encodeURIComponent(str)));
} catch (error) {
console.error("Error in Base64 encoding:", error);
return str; // Return original string in case of error
}
}
function replaceCharacters(str) {
// Replaces common letters with symbols to create a "leet" effect
const replacements = {
'a': '@',
'e': '3',
'i': '1',
'o': '0',
's': '$',
't': '7',
};
// Replaces characters based on the defined dictionary, returns new string
return str.split('').map(char => replacements[char.toLowerCase()] ||
char).join('');
}
function reverseString(str) {
// Reverses the string (could be a simple form of obfuscation)
return str.split('').reverse().join('');
}
function testInput(input) {
// Logs the results in a formatted way
console.log(`Testing input: "${input}"`);
}
function enhanceString(str) {
// Creates a variety of string manipulations for testing
return {
original: str,
urlEncoded: urlEncode(str),
base64Encoded: base64Encode(str),
characterReplaced: replaceCharacters(str),
reversed: reverseString(str)
};
}
// Word to test
const word = "cums"; // Changed word here