Question about running "executables" without source code

AI Thread Summary
Classes in C++ can have private, public, and protected members, but completely hiding a class from users is challenging, as some reverse engineering is possible. When a program is compiled, the source code is transformed into a binary executable, making it difficult to recover high-level constructs. Executables may still rely on external libraries, which complicates the distribution of standalone applications. For example, Python is not a compiled language in the traditional sense, and sending just an executable may not work if it requires additional components like interpreters or libraries. Ultimately, while it's possible to obscure code, complete protection from user access is not guaranteed.
ChrisVer
Science Advisor
Messages
3,372
Reaction score
465
I have a simple question I guess, basically by how classes etc are formed. In general a class in C++ has some categories such as private, public and protected, which okay everyone knows/can find what they are meant for. E.g. a private member will not be accessible outside the class member functions. My question is then, is it possible to completely hide it from the user then? Or even hide the whole class if you don't want them to "play around" with it?
As an example, my question is related to the intermediate step between having a source code which runs and produces executables from the programmer, and the application which is publicly distributed. When I install a game X, I am unable to see the code which actually built it and runs behind the scene [except maybe for if I am a cheater or something]. what happened to it? In the past I had tried sending to a friend just the executable of a fun project I made [with python in that case], but she was unable to run it without the code- however I didn't want to send the code which would need more stuff from her side to run [e.g. download the necessary interpreter, modules etc] but also because it would make the project easy to change by the user.
 
Technology news on Phys.org
ChrisVer said:
I have a simple question I guess, basically by how classes etc are formed. In general a class in C++ has some categories such as private, public and protected, which okay everyone knows/can find what they are meant for. E.g. a private member will not be accessible outside the class member functions. My question is then, is it possible to completely hide it from the user then? Or even hide the whole class if you don't want them to "play around" with it?
These are high level constructs. It is possible to reverse engineer some things, like figuring out algorithms, by looking at executables, but I would be very surprised if someone could recover object-oriented constructs.

ChrisVer said:
As an example, my question is related to the intermediate step between having a source code which runs and produces executables from the programmer, and the application which is publicly distributed. When I install a game X, I am unable to see the code which actually built it and runs behind the scene [except maybe for if I am a cheater or something]. what happened to it?
The code was transformed into a binary executable, which involved a compiler going many times through some high-level code and mangling it into a series of assembly language instructions, including some optimization. One can disassemble the binary to get back assembly code, but figuring out what it is doing is going to be hard.

ChrisVer said:
In the past I had tried sending to a friend just the executable of a fun project I made [with python in that case], but she was unable to run it without the code- however I didn't want to send the code which would need more stuff from her side to run [e.g. download the necessary interpreter, modules etc] but also because it would make the project easy to change by the user.
Python is not really a compiled language, isn't it? Also, compiled programs may rely on outside code found in libraries. Make an executable doesn't necessarily mean making something that is stand-alone.
 
  • Like
Likes QuantumQuest
That's what a library is. You know how if you want to talk to a database, you #include <mysql.h>, but if you look at mysql.h, it's just a list of functions with no actual code? That's because that's the public interface for what is behind the scenes a very complicated piece of software. That's because you also have to link mysql.lib. This .lib file (can also be .dll, .so, .a) is a precompiled library. It means the original source was compiled with a public interface, and you can use it as though it were just more code.
 
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.
Back
Top