source code hiding.

9 次查看(过去 30 天)
David Taylor
David Taylor 2011-11-28
hi. I would like to know how i can hide the source codes i have written so that nobody can access them? even a professional user! Thanks.

回答(2 个)

Robert Cumming
Robert Cumming 2011-11-28

Jan
Jan 2011-11-28
P-coding prevents the user from reading the source. But the function can still be accessed in the meaning of executed by Matlab. Do you want to forbid the execution also? Then encrypt the files.
A professional user can use the debugger to run through the P-coded function line by line abd inspect all changes in variables. Even local variables can be changed on-the-fly and all used functions can be shadowed. Therefore a password protection like this has a very limited security level:
function Match = CheckPassword(In)
Password = '1234asdf';
Match = strcmp(In, Password);
end
P-coding conceals the source. But if you create a file called "strcmp.m" in the same folder, the password can be displayed easily:
function T = strcmp(A, B)
disp(A);
disp(B);
T = true;
end
But you can avoid calling toolbox functions for critical sections:
function Match = CheckPassword(In)
switch In
case '1234asdf'
Match = 1;
otherwise
Match = 0;
end
end
But such construction are usually too strange and limited for a very small set of commands. E.g. I did not use true and false to avoid the possibility for overloading them...
I think, the Matlab Compiler is the best method to conceal the contents of M-files. But even here you cannot be 100% secure and if your program is expensive enough, a professional will be able to find out, what's going on.

类别

Help CenterFile Exchange 中查找有关 Scope Variables and Generate Names 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by