2

I need to write a program in either Python or MATLAB that contains some proprietary information, but will not easily reveal this proprietary information if the program is distributed.

While I realize that a determined hacker can reverse engineer any source code, would it be easier to secure code written in Python or MATLAB?

3
  • Not in python. You can distribute the "compiled" .pyc files instead of the .py files... but that's python bytecode and can pretty easily be unraveled. Commented May 9, 2013 at 15:00
  • Is it data or your implementation that you are trying to protect? Commented May 9, 2013 at 15:55
  • I am trying to protect the implementation, specifically some equations. There isn't any data written into the program. Commented May 12, 2013 at 14:00

2 Answers 2

4

In MATLAB you can use the command pcode, which preparses your MATLAB code to a form that is unreadable by humans, but runs exactly the same (actually, very slightly faster) as the original MATLAB code. What happens is that for each .m file you pcode, you'll get a new file with a .p extension. The .p file runs the same as the .m file, but is unreadable.

Alternatively, you can purchase MATLAB Compiler, which will convert your entire application into a standalone executable where the code is encrypted.

Sign up to request clarification or add additional context in comments.

4 Comments

+1: Just nitpicking: the code in the standalone executable is not encrypted, it's machine code. Theoretically speaking, it can be reverse engineered.
The documentation for pcode is a little confusing. Sometimes it states it encrypts, and sometimes content-obscures. If it is encrypted, the presumably you must also provide some method to decrypt at run time for legitimate users.
@EitanT No, that's not true. MATLAB Compiler produces a thin executable wrapper which, true, is machine code. But all this wrapper does is to start up the MCR and then execute your MATLAB code against it. The MATLAB code is packaged with the thin excutable wrapper and possibly the MCR, and is encrypted, not machine code. It's encrypted with AES.
@SamRoberts Huh, I've double-checked the MathWorks documentation again, and it seems that you're right. I stand corrected!
1

It seems to be pretty easy to do in MATLAB:

pcode <filename>

See the Documentation Center.

For python see the Python wiki.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.