MATLAB Answers

How to decrypt a pcode?

758 views (last 30 days)
math98
math98 on 20 Jun 2011
Edited: Rik on 10 Dec 2020
Hi,
Is there an experienced MATLAB user to provide me with some info on how to decrypt a given pcode?
P.S: It seems that I have to use a pcode version of my original code. Actually, I heard from an old MATLAB user that there are some ways to decrypt a pcode. (to obtain the original code) Of course, by advanced user (hackers :-O ) not newbies!!
Thanks

  2 Comments

Walter Roberson
Walter Roberson on 20 Jun 2011
I am *not* old -- I am merely chronologically cumulative!
math98
math98 on 20 Jun 2011
:))
Dear Walter, I didn't mean you. Actually, I heard that from another guy.
but, I meant someone like you by "experienced user". and I'm waiting to see your answer. (of course, if possible)

Sign in to comment.

Accepted Answer

Jan
Jan on 20 Jun 2011
Edited: Jan on 26 Dec 2017
No, there is no decoding method for P-coded functions.
You can use the debugger to step through the code line by line, inspect changes to variables and get a list of called functions. But you cannot get the source code as clear text. And most likely: You are explicitly not wanted to! A decompilation or reverse-engineering of a program usually conflicts with the license conditions and is illegal.
[EDITED] This thread seems to show, that P-coding is less cryptic than I thought: http://www.mathworks.com/matlabcentral/answers/75012-pcode-obfuscation-cracked-alternatives
[EDITED 2] Modern Matlab versions prevent the debugging of P-files.

  5 Comments

Show 2 older comments
math98
math98 on 20 Jun 2011
Jan,
thank for the reply.
but could you please tell me how it's possible to debug a pfile? MATLAB documents show that the debugger is accessible just for mfiles.
Jan
Jan on 20 Jun 2011
@math98: Matlab has some undocumented features. I'd go into details, if I see a legal demand. Some general remarks about the security of P-files: http://www.mathworks.com/matlabcentral/newsreader/view_thread/284802 , http://www.mathworks.com/matlabcentral/newsreader/view_thread/271697
wonderkismet
wonderkismet on 10 Dec 2020
Click to Send Request for pcode Recovery [link removed]

Sign in to comment.

More Answers (4)

ou dk
ou dk on 2 Jan 2020
in fact ,i can decrypt all type code,include standalone program,p code,other language compiled matlab program.

  12 Comments

Show 9 older comments
ou dk
ou dk on 12 Aug 2020
No, I think P code is safe enough in general, because the average application is not going to be a target, of course, security is always relative, keep this in mind.
ou dk
ou dk on 12 Aug 2020
I don't think MathWorks is wrong with the choice, for example, m code processing is actually AES encryption and a compression algorithm, P-CODE is basically a compression algorithm, and then interpretation execution, so that efficiency will improve, if too much consideration of security, it will make the already inefficient MATLAB slow as a snail.
I write code, always spend time on security and efficiency, there is always a balance between the two.
Roger Valdivia Salazar
Roger Valdivia Salazar on 24 Aug 2020
Hey ou dk, can you share with me that article you talked about above? Thank you so much

Sign in to comment.


Meme Young
Meme Young on 11 Aug 2020
Oh man you have really asked a good question, like claiming yourself to be a bank robber in front of a police department

  5 Comments

Show 2 older comments
ou dk
ou dk on 12 Aug 2020
moot discussion? no, I can do it differently from what I want to do, at least to remind users that these methods are not as safe as claimed.
You can refer to my last answer to Bruno Luong,P file recovery is accurate for line breaks and carriage returns.
Indeed, I will never open up services to the public.
Rik
Rik on 13 Aug 2020
Comment posted as flag by Meme Young:
Ok Robin can you recover some p codes?
ou dk
ou dk on 22 Aug 2020
A small number of files are available, but you can't use them for profit.

Sign in to comment.


Fangjun Jiang
Fangjun Jiang on 20 Jun 2011
I thought the Mathworks could do it. But they won't do it. After all, it is put in place to protect many of its source code (part of the reason, I believe). It can be used to protect the user's customer-developed source code too, which is what I like. Hacking is possible, technically. If you find a way, please let me know.

  9 Comments

Show 6 older comments
Fangjun Jiang
Fangjun Jiang on 23 Jun 2011
All right! BTW, I misunderstood Walter's comment. He did take credit for being that MATLAB user. He just didn't want to admit that he is old.
Yair Altman
Yair Altman on 21 Jul 2011
@Jan - I have just seen this thread and I must say that I take offense at being labeled a cracker or hacker. For the record, and you can quote me on this, none of what I do or publish is illegal, to the best of my knowledge and intentions. I am very careful about this. My livelihood depends on Matlab to a large extent and I will not cut the branch I'm sitting on.
Jan
Jan on 21 Jul 2011
@Yair: Sorry. I did not meant the term "hacking" in any offending way and I'm definitely convinced from all I've seen and heared in the last years, that your work is legal and helpful for Matlab users and in consequence for TMW. I'm used to distinguish the illegal "cracking" from the legal "hacking", which means digging in the codes for the not barely obvious features. If any of your investigations and publications of the golden beans you've found is not legal -what is not the case!-, I'd strongly recommend that you get payed by TMW to catch up a legalization retrospectively.
Anyhow, Yair, I've deleted the concerning comment, because I know that the term "hacking" might be misunderstood.

Sign in to comment.


jgd0008
jgd0008 on 9 Feb 2018
I know it´s an old subject. This guy had an utility running on the web. I used a couple of times, had some minor flaws. However, it´s been asked to be taken down.
web-service.sippey.org/de_pcode
So, it´s possible

  0 Comments

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!