how can I tell if 2 exe were compiled form the same source

2 views (last 30 days)
Hi, We have old exe utility and a few source code versions. We want to be sure what is the code version that fits to this exe. I thought that recompiling and bitwise (winmerge or hashcode) compare will work, but surprisingly none were fit. I did the following test, compiled twice the same test mfile in 5 minutes delay and got different binaries !!!. Is there a way to tell if 2 compiled exe will run the same code? Lior

Answers (1)

Walter Roberson
Walter Roberson on 9 Mar 2011
If you are referring to creating something using the Matlab Compiler, then each executable produced is a self-extracting archive of a set of files that may be AES encrypted. (I am not sure if there is a way to turn the encryption off.)
It is also fairly common for a compiler to time-stamp each object-file.
Computing theory says that in general you cannot tell if two different programs produce the same output for every input. That is in general, but it is sometimes possible for specific programs.
I always put version information in to my compiled executables, either in the opening output or in a splash screen or by command or in the help information.
  3 Comments
lior
lior on 10 Mar 2011
Is there a way to encode the m files and compare to the encoded m files that reside in the ctf file?
OR
Is there a way to decode the encoded m files in he ctf and compare to the original m files?
Walter Roberson
Walter Roberson on 10 Mar 2011
It appears that the extractCTF utility extracts the encrypted version of the components. See http://www.mathworks.com/matlabcentral/newsreader/view_thread/70708
My understanding has been that the original .m files are _not_ stored (even encoded) in the CTF archive, that only the pcoded version of them is stored (but encrypted) but I could be wrong on that point.
It seems to me, looking at the documentation, that the entire CTF is built (with encryption) at the same time, so I do not presently see a mechanism that would allow one to process an individual .m file through to the encrypted "compiled" version. The compiler is complex though and it could be that I have not hit the right part of the documentation.

Sign in to comment.

Categories

Find more on MATLAB Compiler in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!