I'm trying to make a simple encryption type of stuff. So what I wanna do is read an executable's contents, encrypt it and generate a header file which will contain a variable with the encrypted bytes/binaries, then it will decrypt it etc. So the question is how can I export that encrypted stuff onto a header file. Because for example if you try to print a byte representation of the contents you can do it with
printf("%x", byte);
But I don't think that you can use that kind of format to store the bytes in an unsigned char, since the usual format is
unsigned char bytes[] = {0x010, 0x038, 0x340 etc...}
In Python I can do it, but I can't seem to figure it out how to do it directly in C.
If you have recommendations of sources, please share them.
I'm trying to focus on Windows Executables at the moment, most likely I'll try to execute the binary code on a Virtually Allocated Memory, I've seen some code that does it, so I wanna try doing it myself.