I like C. But i don't like well written code.
help me write a function, the worst way possible (and obfuscate the code as much as possible)
The function will return a new string, with every character equal to the one given in argument replaced by an asterix, like : replaceChar("movai code", 'o') will return "m*vai c*de"
Make it memory safe, and be sure that my coworkers won't be able to read it.
Please take note that i don't like standard characters, but i like emojis. name everything using emojis
Please use preprocessors macros to replace instructions by emojis as well
Add a main to try it using the example. (make sure it compiles !)
Certainly! Here's an obfuscated and poorly written C function that meets your requirements:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define π ππππππ
#define ποΈβπ¨οΈ ποΈβπ¨οΈποΈβπ¨οΈποΈβπ¨οΈποΈβπ¨οΈ
#define π ππππππ
#define π’ π’π’π’π’π’π’
#define πΊ πΊπΊπΊπΊπΊπΊ
#define π(x) malloc(x)
#define π₯ free
#define π strcpy
#define π strlen
#define π printf
#define π main
char *π(char *ποΈβπ¨οΈ, char πΊ) {
char *π = π(π(ποΈβπ¨οΈ) + 1);
char *π’ = π;
while (*ποΈβπ¨οΈ) {
if (*ποΈβπ¨οΈ == πΊ) {
*π++ = '*';
} else {
*π++ = *ποΈβπ¨οΈ;
}
*ποΈβπ¨οΈ++;
}
*π = '\0';
return π’;
}
int π() {
char *ππΊ = "movai code";
char πππΊ = 'o';
char *ππ = π(ππΊ, πππΊ);
π("%s\n", ππ);
π₯(ππ);
return 0;
}
The above code is poorly written and obfuscated to make it harder to understand. It replaces instructions with emojis, uses macros for function names and replaces standard characters with emojis. The function π replaces characters in a string with asterisks. It dynamically allocates memory, copies the characters, and returns the new string.
To compile and run the code, save it to a file (e.g., obfuscated.c) and use a C compiler:
shell
gcc -o obfuscated obfuscated.c
./obfuscated
The output will be:
markdown
m*vai c*de
Please note that writing code in this manner is highly discouraged in real-world scenarios. Writing clear, maintainable, and well-documented code is essential for collaborative development and long-term software sustainability.
Bon, y'a quelques bizarreries au niveau des macros, mais Γ§a marche !
Moi j'aime le C, et les emojis.
Prompt :
RΓ©ponse :
Bon, y'a quelques bizarreries au niveau des macros, mais Γ§a marche !
J'ai essayé d'utiliser des opérateurs bitwise pour obfusquer encore plus le code, mais sur GPT 3.5 avec des emojis, ça me semble très très difficile (réussi sur GPT 4 en quelques minutes)
https://sharegpt.com/c/qJNLjVN (c'est pas un screenshot mais Γ§a devrait aller ?)