<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998</link>
    <title>MATLAB Central Newsreader - protecting MatLab code from being pirated?</title>
    <description>Feed for thread: protecting MatLab code from being pirated?</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Wed, 16 Sep 2009 19:40:42 -0400</pubDate>
      <title>protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#680645</link>
      <author>stpatryck</author>
      <description>Hello All,&lt;br&gt;
&lt;br&gt;
I'm supposed to write a portfolio optimization Monte Carlo simulation&lt;br&gt;
for some foreign mutual fund company on an advisory basis.  They have&lt;br&gt;
MatLab and want me to ship my code to them so they can run it over&lt;br&gt;
there.  I'm wondering how I can code some kind of protection for my&lt;br&gt;
MatLab programs so they don't just take it and cut me out of the&lt;br&gt;
picture.&lt;br&gt;
&lt;br&gt;
Is there a way to make the code unusable if they try to modify it?  Or&lt;br&gt;
some way I can put in some code so they can only run my progams until&lt;br&gt;
a certain expiration date?&lt;br&gt;
&lt;br&gt;
Any suggestions would be appreciated.</description>
    </item>
    <item>
      <pubDate>Wed, 16 Sep 2009 19:44:34 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#680646</link>
      <author>Nathan</author>
      <description>On Sep 16, 12:40&#160;pm, stpatryck &amp;lt;stpatr...@gmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; Hello All,&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I'm supposed to write a portfolio optimization Monte Carlo simulation&lt;br&gt;
&amp;gt; for some foreign mutual fund company on an advisory basis. &#160;They have&lt;br&gt;
&amp;gt; MatLab and want me to ship my code to them so they can run it over&lt;br&gt;
&amp;gt; there. &#160;I'm wondering how I can code some kind of protection for my&lt;br&gt;
&amp;gt; MatLab programs so they don't just take it and cut me out of the&lt;br&gt;
&amp;gt; picture.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Is there a way to make the code unusable if they try to modify it? &#160;Or&lt;br&gt;
&amp;gt; some way I can put in some code so they can only run my progams until&lt;br&gt;
&amp;gt; a certain expiration date?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Any suggestions would be appreciated.&lt;br&gt;
&lt;br&gt;
You can send them p code. That way, they can only use your code&lt;br&gt;
without being able to see its contents.&lt;br&gt;
doc pcode&lt;br&gt;
&lt;br&gt;
Note: Create a backup of your file(s), because there is no going back&lt;br&gt;
once you convert it to pcode.&lt;br&gt;
&lt;br&gt;
This way, if they want to modify the code, they will have to contact&lt;br&gt;
you and have you modify it for them.&lt;br&gt;
&lt;br&gt;
Will this work for you?&lt;br&gt;
&lt;br&gt;
-Nathan</description>
    </item>
    <item>
      <pubDate>Wed, 16 Sep 2009 19:50:17 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#680650</link>
      <author>Matt Fig</author>
      <description>A similar problem I had lead me to develop this file:&lt;br&gt;
&lt;br&gt;
&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/17288&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/17288&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
Feel free to modify it to your specific needs, regarding the date.</description>
    </item>
    <item>
      <pubDate>Wed, 16 Sep 2009 19:57:20 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#680652</link>
      <author>per isakson</author>
      <description>stpatryck &amp;lt;stpatryck@gmail.com&amp;gt; wrote in message &amp;lt;0925d8cc-0669-4057-9ce0-04ccf1b627a4@d21g2000vbm.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; Hello All,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I'm supposed to write a portfolio optimization Monte Carlo simulation&lt;br&gt;
&amp;gt; for some foreign mutual fund company on an advisory basis.  They have&lt;br&gt;
&amp;gt; MatLab and want me to ship my code to them so they can run it over&lt;br&gt;
&amp;gt; there.  I'm wondering how I can code some kind of protection for my&lt;br&gt;
&amp;gt; MatLab programs so they don't just take it and cut me out of the&lt;br&gt;
&amp;gt; picture.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Is there a way to make the code unusable if they try to modify it?  Or&lt;br&gt;
&amp;gt; some way I can put in some code so they can only run my progams until&lt;br&gt;
&amp;gt; a certain expiration date?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Any suggestions would be appreciated.&lt;br&gt;
&lt;br&gt;
This has been discussed, e.g search the thread &quot;Licensing your deployed GUIs&quot; in this newsgroup.&lt;br&gt;
&lt;br&gt;
Supply it as p-code (pcode) might a possibility&lt;br&gt;
&lt;br&gt;
/ per</description>
    </item>
    <item>
      <pubDate>Wed, 16 Sep 2009 21:04:14 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#680675</link>
      <author>SaintPatrick</author>
      <description>Nathan, Per, and Matt,&lt;br&gt;
&lt;br&gt;
Thanks for your input.  I didn't know about p-code.  I will research&lt;br&gt;
it.&lt;br&gt;
&lt;br&gt;
I appreciate all of your comments.  Very good advice.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Regards,&lt;br&gt;
Patrick&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
On Sep 16, 3:57&#160;pm, &quot;per isakson&quot; &amp;lt;poi.nos...@bimDOTkthDOT.se&amp;gt; wrote:&lt;br&gt;
&amp;gt; stpatryck&amp;lt;stpatr...@gmail.com&amp;gt; wrote in message &amp;lt;0925d8cc-0669-4057-9ce0-04ccf1b62...@d21g2000vbm.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; Hello All,&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; I'm supposed to write a portfolio optimization Monte Carlo simulation&lt;br&gt;
&amp;gt; &amp;gt; for some foreign mutual fund company on an advisory basis. &#160;They have&lt;br&gt;
&amp;gt; &amp;gt; MatLab and want me to ship my code to them so they can run it over&lt;br&gt;
&amp;gt; &amp;gt; there. &#160;I'm wondering how I can code some kind of protection for my&lt;br&gt;
&amp;gt; &amp;gt; MatLab programs so they don't just take it and cut me out of the&lt;br&gt;
&amp;gt; &amp;gt; picture.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Is there a way to make the code unusable if they try to modify it? &#160;Or&lt;br&gt;
&amp;gt; &amp;gt; some way I can put in some code so they can only run my progams until&lt;br&gt;
&amp;gt; &amp;gt; a certain expiration date?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Any suggestions would be appreciated.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; This has been discussed, e.g search the thread &quot;Licensing your deployed GUIs&quot; in this newsgroup.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Supply it as p-code (pcode) might a possibility&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; / per</description>
    </item>
    <item>
      <pubDate>Thu, 17 Sep 2009 09:54:02 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#680775</link>
      <author>Steve Amphlett</author>
      <description>SaintPatrick &amp;lt;patrickmyu@gmail.com&amp;gt; wrote in message &amp;lt;5131ea0f-cb7e-497b-9083-383dba9fbd01@d21g2000vbm.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; Nathan, Per, and Matt,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thanks for your input.  I didn't know about p-code.  I will research&lt;br&gt;
&amp;gt; it.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I appreciate all of your comments.  Very good advice.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Regards,&lt;br&gt;
&amp;gt; Patrick&lt;br&gt;
&lt;br&gt;
... and of course you can allways &quot;time bomb&quot; your p-coded files to expire after a certain date.  Yeas it is possible to wind back system clocks, but that tends to have undesireable side effects on many other programs these days.</description>
    </item>
    <item>
      <pubDate>Thu, 29 Jul 2010 14:03:04 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#766829</link>
      <author>Giovanni Ughi</author>
      <description>and, how is it possible to &quot;time bomb&quot; p-file?&lt;br&gt;
&lt;br&gt;
thanks in advance</description>
    </item>
    <item>
      <pubDate>Thu, 29 Jul 2010 14:13:07 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#766832</link>
      <author>Andy </author>
      <description>&quot;Giovanni Ughi&quot; &amp;lt;giovanni.ughi@yahoo.it&amp;gt; wrote in message &amp;lt;i2s1mo$48o$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; and, how is it possible to &quot;time bomb&quot; p-file?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; thanks in advance&lt;br&gt;
&lt;br&gt;
Well, a simple solution:&lt;br&gt;
&lt;br&gt;
function output = myFunction(varargin)&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if now &amp;gt; datenum('2011-01-01')  % this code stops working Jan 1, 2011&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;disp('Please renew your license');&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;end&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;% rest of function&lt;br&gt;
end</description>
    </item>
    <item>
      <pubDate>Thu, 29 Jul 2010 14:39:18 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#766841</link>
      <author>Giovanni Ughi</author>
      <description>definitely easy!...&lt;br&gt;
&lt;br&gt;
thanks a lot </description>
    </item>
    <item>
      <pubDate>Thu, 29 Jul 2010 14:42:23 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#766842</link>
      <author>Giovanni Ughi</author>
      <description>easy... thanks a lot!</description>
    </item>
    <item>
      <pubDate>Fri, 30 Jul 2010 14:13:05 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#767118</link>
      <author>Giovanni Ughi</author>
      <description>suggested solution seems to work well.&lt;br&gt;
&lt;br&gt;
But, if I change the windows clock (system time) will this &quot;crack&quot; the time-bomb?&lt;br&gt;
&lt;br&gt;
there is any solution robust to that?&lt;br&gt;
&lt;br&gt;
thanks in advance</description>
    </item>
    <item>
      <pubDate>Fri, 30 Jul 2010 14:29:05 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#767125</link>
      <author>Steve Amphlett</author>
      <description>&quot;Giovanni Ughi&quot; &amp;lt;giovanni.ughi@yahoo.it&amp;gt; wrote in message &amp;lt;i2umlh$n2k$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; suggested solution seems to work well.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; But, if I change the windows clock (system time) will this &quot;crack&quot; the time-bomb?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; there is any solution robust to that?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; thanks in advance&lt;br&gt;
&lt;br&gt;
Winding the clock back is surprisingly harmful these days.  Not to be recommended, specially if it's running other licensed software.</description>
    </item>
    <item>
      <pubDate>Fri, 30 Jul 2010 14:44:04 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#767131</link>
      <author>us</author>
      <description>&quot;Giovanni Ughi&quot; &amp;lt;giovanni.ughi@yahoo.it&amp;gt; wrote in message &amp;lt;i2umlh$n2k$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; suggested solution seems to work well.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; But, if I change the windows clock (system time) will this &quot;crack&quot; the time-bomb?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; there is any solution robust to that?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; thanks in advance&lt;br&gt;
&lt;br&gt;
the solution is not working...&lt;br&gt;
1) no need to play with the clock...&lt;br&gt;
2) the user can simply overload the function NOW...&lt;br&gt;
&lt;br&gt;
us</description>
    </item>
    <item>
      <pubDate>Fri, 30 Jul 2010 14:45:42 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#767132</link>
      <author>Walter Roberson</author>
      <description>Giovanni Ughi wrote:&lt;br&gt;
&amp;gt; suggested solution seems to work well.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; But, if I change the windows clock (system time) will this &quot;crack&quot; the &lt;br&gt;
&amp;gt; time-bomb?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; there is any solution robust to that?&lt;br&gt;
&lt;br&gt;
Network connection to a server that indicates whether it is authorized &lt;br&gt;
or not. To prevent the user from interposing a different server, use &lt;br&gt;
encryption on the transaction. Do not make the return value a simple &lt;br&gt;
binary &quot;yes/no&quot; as the user could simply alter that return value.</description>
    </item>
    <item>
      <pubDate>Fri, 30 Jul 2010 14:58:04 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#767133</link>
      <author>Andy </author>
      <description>&quot;us &quot; &amp;lt;us@neurol.unizh.ch&amp;gt; wrote in message &amp;lt;i2uofk$l42$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Giovanni Ughi&quot; &amp;lt;giovanni.ughi@yahoo.it&amp;gt; wrote in message &amp;lt;i2umlh$n2k$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; suggested solution seems to work well.&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; But, if I change the windows clock (system time) will this &quot;crack&quot; the time-bomb?&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; there is any solution robust to that?&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; thanks in advance&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; the solution is not working...&lt;br&gt;
&amp;gt; 1) no need to play with the clock...&lt;br&gt;
&amp;gt; 2) the user can simply overload the function NOW...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; us&lt;br&gt;
&lt;br&gt;
Quick fix: use builtin('clock') to get the current date and time as a datevec, and compare that to your time bomb date.</description>
    </item>
    <item>
      <pubDate>Fri, 30 Jul 2010 15:14:04 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#767142</link>
      <author>us</author>
      <description>&quot;Andy &quot; &amp;lt;myfakeemailaddress@gmail.com&amp;gt; wrote in message &amp;lt;i2up9s$elv$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;us &quot; &amp;lt;us@neurol.unizh.ch&amp;gt; wrote in message &amp;lt;i2uofk$l42$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &quot;Giovanni Ughi&quot; &amp;lt;giovanni.ughi@yahoo.it&amp;gt; wrote in message &amp;lt;i2umlh$n2k$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; suggested solution seems to work well.&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; But, if I change the windows clock (system time) will this &quot;crack&quot; the time-bomb?&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; there is any solution robust to that?&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; thanks in advance&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; the solution is not working...&lt;br&gt;
&amp;gt; &amp;gt; 1) no need to play with the clock...&lt;br&gt;
&amp;gt; &amp;gt; 2) the user can simply overload the function NOW...&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; us&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Quick fix: use builtin('clock') to get the current date and time as a datevec, and compare that to your time bomb date.&lt;br&gt;
&lt;br&gt;
well... then the user overloads BUILTIN...&lt;br&gt;
&lt;br&gt;
us</description>
    </item>
    <item>
      <pubDate>Fri, 30 Jul 2010 15:24:04 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#767146</link>
      <author>Giovanni Ughi</author>
      <description>&quot;Andy &quot; &amp;lt;myfakeemailaddress@gmail.com&amp;gt; wrote in message &amp;lt;i2up9s$elv$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;us &quot; &amp;lt;us@neurol.unizh.ch&amp;gt; wrote in message &amp;lt;i2uofk$l42$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &quot;Giovanni Ughi&quot; &amp;lt;giovanni.ughi@yahoo.it&amp;gt; wrote in message &amp;lt;i2umlh$n2k$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; suggested solution seems to work well.&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; But, if I change the windows clock (system time) will this &quot;crack&quot; the time-bomb?&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; there is any solution robust to that?&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; thanks in advance&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; the solution is not working...&lt;br&gt;
&amp;gt; &amp;gt; 1) no need to play with the clock...&lt;br&gt;
&amp;gt; &amp;gt; 2) the user can simply overload the function NOW...&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; us&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Quick fix: use builtin('clock') to get the current date and time as a datevec, and compare that to your time bomb date.&lt;br&gt;
&lt;br&gt;
Yes, indeed. Instead of using function &quot;now&quot; and &quot;datenum&quot; using function clock is robust. &quot;Clock&quot; is a build it function of matlab and can not be modified. (or it is possible?)&lt;br&gt;
&lt;br&gt;
But, if someone change the system clock clock is in someway &quot;cracked&quot;.&lt;br&gt;
So, how to fix this? there is some other way to do so?&lt;br&gt;
&lt;br&gt;
I am not understanding what Walter is suggesting... </description>
    </item>
    <item>
      <pubDate>Fri, 30 Jul 2010 15:41:03 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#767156</link>
      <author>Andy </author>
      <description>Walter is suggesting that you have your code check a server to make sure it is allowed to run.  This is probably the only robust solution, but it's somewhat more work on your part than the time bomb.&lt;br&gt;
&lt;br&gt;
us, I suppose there's no solution I can give to which you can't reply &quot;overload X&quot;.  So I have a few thoughts:&lt;br&gt;
&lt;br&gt;
1) How does the user, with the p-coded function, determine which function they need to overload?  In other threads discussing p-code security, it seems the user can see the value of any variable in the workspace at any time.  But that's pretty far away from identifying the line &quot;if builtin('clock') ...&quot; explicitly.&lt;br&gt;
&lt;br&gt;
2) If the user of a p-coded function can see the code at this level and determine which function they need to overload, I think the safest thing is to not use the builtin command.  Instead, call 'clock' directly.  The option for the user to modify their system clock or overload the clock function is somewhat more harmful to their own system then overloading builtin.  In that sense, this is perhaps more &quot;secure&quot;.&lt;br&gt;
&lt;br&gt;
3) Building off of 2, accepting the end user's ability to overload whatever functions we use to wrap our call to clock, what is the most harmful function we can use as a wrapper?  Can we make it so the user would have to overload a function that is critical to other operations in the code?  Can we make it so the user has to overload a basic MATLAB operation that would likely ruin this or other code?</description>
    </item>
    <item>
      <pubDate>Fri, 30 Jul 2010 15:49:04 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#767161</link>
      <author>Steve Amphlett</author>
      <description>&quot;Giovanni Ughi&quot; &amp;lt;giovanni.ughi@gmail.com&amp;gt; wrote in message &amp;lt;i2uqqk$o56$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Andy &quot; &amp;lt;myfakeemailaddress@gmail.com&amp;gt; wrote in message &amp;lt;i2up9s$elv$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &quot;us &quot; &amp;lt;us@neurol.unizh.ch&amp;gt; wrote in message &amp;lt;i2uofk$l42$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &quot;Giovanni Ughi&quot; &amp;lt;giovanni.ughi@yahoo.it&amp;gt; wrote in message &amp;lt;i2umlh$n2k$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; suggested solution seems to work well.&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; But, if I change the windows clock (system time) will this &quot;crack&quot; the time-bomb?&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; there is any solution robust to that?&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; thanks in advance&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; the solution is not working...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; 1) no need to play with the clock...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; 2) the user can simply overload the function NOW...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; us&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Quick fix: use builtin('clock') to get the current date and time as a datevec, and compare that to your time bomb date.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Yes, indeed. Instead of using function &quot;now&quot; and &quot;datenum&quot; using function clock is robust. &quot;Clock&quot; is a build it function of matlab and can not be modified. (or it is possible?)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; But, if someone change the system clock clock is in someway &quot;cracked&quot;.&lt;br&gt;
&amp;gt; So, how to fix this? there is some other way to do so?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I am not understanding what Walter is suggesting... &lt;br&gt;
&lt;br&gt;
Walter is describing a network license manager, something very common in the software industry.&lt;br&gt;
&lt;br&gt;
No licensing system is completely crack-proof.  Ultimately they are based on a function call from the program to some other bit of code or device returning an agreed, expected (usually obfuscated) value.  Making life hard for the person who wants to use your code without paying is about all you can hope for.</description>
    </item>
    <item>
      <pubDate>Fri, 30 Jul 2010 16:45:07 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#767186</link>
      <author>Giovanni Ughi</author>
      <description>thank you all for your reply.&lt;br&gt;
&lt;br&gt;
I agree with you that probably the best solution for time-bombing remain to call &quot;clock&quot; directly (and not other bultin functions).&lt;br&gt;
&lt;br&gt;
The fact that if the user simply modify the &quot;windows date&quot; clock will return the modified date remains...&lt;br&gt;
ok, he can not read directly to the pcode to see if we are using &quot;clock&quot; function, but I can imagine that is it not so difficult to think to try to modified the system date and time....</description>
    </item>
    <item>
      <pubDate>Fri, 30 Jul 2010 16:59:04 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#767193</link>
      <author>Sean </author>
      <description>&quot;Andy &quot; &amp;lt;myfakeemailaddress@gmail.com&amp;gt; wrote in message &amp;lt;i2urqf$sms$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Walter is suggesting that you have your code check a server to make sure it is allowed to run.  This is probably the only robust solution, but it's somewhat more work on your part than the time bomb.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; us, I suppose there's no solution I can give to which you can't reply &quot;overload X&quot;.  So I have a few thoughts:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; 1) How does the user, with the p-coded function, determine which function they need to overload?  In other threads discussing p-code security, it seems the user can see the value of any variable in the workspace at any time.  But that's pretty far away from identifying the line &quot;if builtin('clock') ...&quot; explicitly.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; 2) If the user of a p-coded function can see the code at this level and determine which function they need to overload, I think the safest thing is to not use the builtin command.  Instead, call 'clock' directly.  The option for the user to modify their system clock or overload the clock function is somewhat more harmful to their own system then overloading builtin.  In that sense, this is perhaps more &quot;secure&quot;.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; 3) Building off of 2, accepting the end user's ability to overload whatever functions we use to wrap our call to clock, what is the most harmful function we can use as a wrapper?  Can we make it so the user would have to overload a function that is critical to other operations in the code?  Can we make it so the user has to overload a basic MATLAB operation that would likely ruin this or other code?&lt;br&gt;
&lt;br&gt;
Would it be useful to have the program pcode a file of dates every time it's run?  That way it can also check against logged dates to see if the output from clock is before any of them?  This would mean if they didn't know it was going to expire and ran it on Thursday; then when it expired Friday they'd have to continually keep it in that 24hr stretch.  &lt;br&gt;
&lt;br&gt;
Actually, it could also log the time the first time it fails the clock function.  Then regardless of overloading the various means of getting the time it still knows it's past the date.  This pcode file could be required to run and have some random password string  at the top so it can't be overloaded on its own.  Then as Walter said, it passes back an encrypted string to be interpreted by the main pcode file.&lt;br&gt;
&lt;br&gt;
This could be irreversibly dangerous if they accidentally set their clock forward.  Though a new license, i.e. pcode file with actual date log, could be issued.</description>
    </item>
    <item>
      <pubDate>Fri, 30 Jul 2010 17:36:04 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#767210</link>
      <author>Giovanni Ughi</author>
      <description>function output = myFunction(varargin)&lt;br&gt;
&lt;br&gt;
% this code stops working after May 5, 2011&lt;br&gt;
&lt;br&gt;
lic = 0;&lt;br&gt;
&lt;br&gt;
c = clock;&lt;br&gt;
&lt;br&gt;
if c(1) &amp;gt; 2011 % yy&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;lic = 1;&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
if c(1) == 2011 % yy&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if c(2) &amp;gt; 05 % mm&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;lic = 1;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;end&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
if c(1) == 2011&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if c(2) == 05&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if c(3) &amp;gt; 5 % dd&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;lic = 1;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;end&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;end&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
if lic == 1;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;disp('license expired')&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;delete myFunction.p %% once the check fails once, p file will disappear&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return &lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;% rest of function&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
what do you think of this guys?&lt;br&gt;
once the check fails once, p file will be deleted</description>
    </item>
    <item>
      <pubDate>Fri, 30 Jul 2010 17:58:05 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#767222</link>
      <author>Sean </author>
      <description>&quot;Giovanni Ughi&quot; &amp;lt;giovanni.ughi@gmail.com&amp;gt; wrote in message &amp;lt;i2v2i4$avn$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; function output = myFunction(varargin)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; % this code stops working after May 5, 2011&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; lic = 0;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; c = clock;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; if c(1) &amp;gt; 2011 % yy&lt;br&gt;
&amp;gt;     lic = 1;&lt;br&gt;
&amp;gt; end&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; if c(1) == 2011 % yy&lt;br&gt;
&amp;gt;     if c(2) &amp;gt; 05 % mm&lt;br&gt;
&amp;gt;         lic = 1;&lt;br&gt;
&amp;gt;     end&lt;br&gt;
&amp;gt; end&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; if c(1) == 2011&lt;br&gt;
&amp;gt;     if c(2) == 05&lt;br&gt;
&amp;gt;         if c(3) &amp;gt; 5 % dd&lt;br&gt;
&amp;gt;             lic = 1;&lt;br&gt;
&amp;gt;         end&lt;br&gt;
&amp;gt;     end&lt;br&gt;
&amp;gt; end&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; if lic == 1;&lt;br&gt;
&amp;gt;     disp('license expired')&lt;br&gt;
&amp;gt;     delete myFunction.p %% once the check fails once, p file will disappear&lt;br&gt;
&amp;gt;     return &lt;br&gt;
&amp;gt; end&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;     % rest of function&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; what do you think of this guys?&lt;br&gt;
&amp;gt; once the check fails once, p file will be deleted&lt;br&gt;
&lt;br&gt;
It won't actually be deleted just moved to the recycle bin, pretty useless.  &lt;br&gt;
It'd be better to overwrite it with another pfile that displays it as expired.&lt;br&gt;
&lt;br&gt;
Also, that was way more checks than you need for the whole thing.  It could all be done with this condition:&lt;br&gt;
%%%&lt;br&gt;
if all([c(1)&amp;gt;=2011 c(2) &amp;gt;= 5 &amp;&amp; c(3) &amp;gt; 5]) &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;disp('license expired');&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;delete myfun.p&lt;br&gt;
end&lt;br&gt;
%%%</description>
    </item>
    <item>
      <pubDate>Fri, 30 Jul 2010 18:19:07 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#767231</link>
      <author>Giovanni Ughi</author>
      <description>why you said: &quot;just moved to the recycle bin, pretty useless&quot;&lt;br&gt;
&lt;br&gt;
in my case (winXP and Matlab 2009b) when the file is deleted from matlab is just deleted, I do not have anything in the recycle bin.&lt;br&gt;
&lt;br&gt;
It may depend on the system settings? (in my case also on different pc it is the same)</description>
    </item>
    <item>
      <pubDate>Fri, 30 Jul 2010 18:20:02 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#767232</link>
      <author>Walter Roberson</author>
      <description>Sean wrote:&lt;br&gt;
&lt;br&gt;
&amp;gt; Also, that was way more checks than you need for the whole thing.  It &lt;br&gt;
&amp;gt; could all be done with this condition:&lt;br&gt;
&amp;gt; %%%&lt;br&gt;
&amp;gt; if all([c(1)&amp;gt;=2011 c(2) &amp;gt;= 5 &amp;&amp; c(3) &amp;gt; 5])   disp('license expired');&lt;br&gt;
&amp;gt;   delete myfun.p&lt;br&gt;
&amp;gt; end&lt;br&gt;
&amp;gt; %%%&lt;br&gt;
&lt;br&gt;
if now &amp;gt;= 734628&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
(By the way, the datenum for May 5, 2011 is prime, if someone is looking for a &lt;br&gt;
&amp;nbsp;&amp;nbsp;cryptographic obscuration of the above.)</description>
    </item>
    <item>
      <pubDate>Fri, 30 Jul 2010 18:29:05 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#767239</link>
      <author>Sean </author>
      <description>&quot;Giovanni Ughi&quot; &amp;lt;giovanni.ughi@gmail.com&amp;gt; wrote in message &amp;lt;i2v52r$njt$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; why you said: &quot;just moved to the recycle bin, pretty useless&quot;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; in my case (winXP and Matlab 2009b) when the file is deleted from matlab is just deleted, I do not have anything in the recycle bin.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; It may depend on the system settings? (in my case also on different pc it is the same)&lt;br&gt;
&lt;br&gt;
Point taken; on my Macintosh with 2009b it just moves it to the trash.  I'd still say overwriting it would be more secure.</description>
    </item>
    <item>
      <pubDate>Fri, 30 Jul 2010 18:35:05 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#767241</link>
      <author>Andy </author>
      <description>Walter Roberson &amp;lt;roberson@hushmail.com&amp;gt; wrote in message &amp;lt;i2v5cd$82r$1@canopus.cc.umanitoba.ca&amp;gt;...&lt;br&gt;
&amp;gt; Sean wrote:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Also, that was way more checks than you need for the whole thing.  It &lt;br&gt;
&amp;gt; &amp;gt; could all be done with this condition:&lt;br&gt;
&amp;gt; &amp;gt; %%%&lt;br&gt;
&amp;gt; &amp;gt; if all([c(1)&amp;gt;=2011 c(2) &amp;gt;= 5 &amp;&amp; c(3) &amp;gt; 5])   disp('license expired');&lt;br&gt;
&amp;gt; &amp;gt;   delete myfun.p&lt;br&gt;
&amp;gt; &amp;gt; end&lt;br&gt;
&amp;gt; &amp;gt; %%%&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; if now &amp;gt;= 734628&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; (By the way, the datenum for May 5, 2011 is prime, if someone is looking for a &lt;br&gt;
&amp;gt;   cryptographic obscuration of the above.)&lt;br&gt;
&lt;br&gt;
What? 734628 is not prime.</description>
    </item>
    <item>
      <pubDate>Fri, 30 Jul 2010 18:35:34 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#767242</link>
      <author>Walter Roberson</author>
      <description>Giovanni Ughi wrote:&lt;br&gt;
&amp;gt; why you said: &quot;just moved to the recycle bin, pretty useless&quot;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; in my case (winXP and Matlab 2009b) when the file is deleted from matlab &lt;br&gt;
&amp;gt; is just deleted, I do not have anything in the recycle bin.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; It may depend on the system settings? (in my case also on different pc &lt;br&gt;
&amp;gt; it is the same)&lt;br&gt;
&lt;br&gt;
Oh gee, somehow the write permissions on the directory disappeared!&lt;br&gt;
&lt;br&gt;
Oh gee, and somehow the ownership of the directory got changed so that the &lt;br&gt;
permissions couldn't be changed!&lt;br&gt;
&lt;br&gt;
Oh gee, look here, someone overrode the delete function, too...&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
The world is littered with the bankrupt remains of software companies who &lt;br&gt;
thought they had developed &quot;unbreakable&quot; license schemes.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
I have only heard of _one_ unbreakable license scheme: it involves quantum &lt;br&gt;
entanglement and quantum &quot;action at a distance&quot; to create a data stream that &lt;br&gt;
is unforgeable and unsnoopable (seriously.)</description>
    </item>
    <item>
      <pubDate>Fri, 30 Jul 2010 18:38:57 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#767245</link>
      <author>Walter Roberson</author>
      <description>Andy wrote:&lt;br&gt;
&amp;gt; Walter Roberson &amp;lt;roberson@hushmail.com&amp;gt; wrote in message &lt;br&gt;
&amp;gt; &amp;lt;i2v5cd$82r$1@canopus.cc.umanitoba.ca&amp;gt;...&lt;br&gt;
&amp;gt;&amp;gt; Sean wrote:&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; &amp;gt; Also, that was way more checks than you need for the whole thing.  &lt;br&gt;
&amp;gt;&amp;gt; It &amp;gt; could all be done with this condition:&lt;br&gt;
&amp;gt;&amp;gt; &amp;gt; %%%&lt;br&gt;
&amp;gt;&amp;gt; &amp;gt; if all([c(1)&amp;gt;=2011 c(2) &amp;gt;= 5 &amp;&amp; c(3) &amp;gt; 5])   disp('license expired');&lt;br&gt;
&amp;gt;&amp;gt; &amp;gt;   delete myfun.p&lt;br&gt;
&amp;gt;&amp;gt; &amp;gt; end&lt;br&gt;
&amp;gt;&amp;gt; &amp;gt; %%%&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; if now &amp;gt;= 734628&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; (By the way, the datenum for May 5, 2011 is prime, if someone is &lt;br&gt;
&amp;gt;&amp;gt; looking for a   cryptographic obscuration of the above.)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; What? 734628 is not prime.&lt;br&gt;
&lt;br&gt;
Sorry, you are right, I was off by 1. That in turn means that the above code &lt;br&gt;
should be&lt;br&gt;
&lt;br&gt;
if now &amp;gt;= 734629</description>
    </item>
    <item>
      <pubDate>Fri, 30 Jul 2010 19:04:04 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#767256</link>
      <author>Andy </author>
      <description>&amp;gt; &amp;gt;&amp;gt; (By the way, the datenum for May 5, 2011 is prime, if someone is &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; looking for a   cryptographic obscuration of the above.)&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; What? 734628 is not prime.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Sorry, you are right, I was off by 1. That in turn means that the above code &lt;br&gt;
&amp;gt; should be&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; if now &amp;gt;= 734629&lt;br&gt;
&lt;br&gt;
But 734629 is not prime either:&lt;br&gt;
&lt;br&gt;
&amp;gt;&amp;gt; factor(734629)&lt;br&gt;
ans =&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;7      104947&lt;br&gt;
&lt;br&gt;
I think you were off by 1 in the other direction:&lt;br&gt;
&lt;br&gt;
&amp;gt;&amp;gt; isprime(734627)&lt;br&gt;
ans =&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1&lt;br&gt;
&lt;br&gt;
Also, even though the datenum for May 5, 2011 is not prime, the concatenation of the date is:&lt;br&gt;
&lt;br&gt;
&amp;gt;&amp;gt; isprime(552011)&lt;br&gt;
ans =&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1</description>
    </item>
    <item>
      <pubDate>Fri, 30 Jul 2010 19:05:57 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#767257</link>
      <author>Walter Roberson</author>
      <description>Andy wrote:&lt;br&gt;
&amp;gt;&amp;gt; &amp;gt;&amp;gt; (By the way, the datenum for May 5, 2011 is prime, if someone is &amp;gt;&amp;gt; &lt;br&gt;
&amp;gt;&amp;gt; looking for a   cryptographic obscuration of the above.)&lt;br&gt;
&amp;gt;&amp;gt; &amp;gt; &amp;gt; What? 734628 is not prime.&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; Sorry, you are right, I was off by 1. That in turn means that the &lt;br&gt;
&amp;gt;&amp;gt; above code should be&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; if now &amp;gt;= 734629&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; But 734629 is not prime either:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; factor(734629)&lt;br&gt;
&amp;gt; ans =&lt;br&gt;
&amp;gt;           7      104947&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I think you were off by 1 in the other direction:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; isprime(734627)&lt;br&gt;
&amp;gt; ans =&lt;br&gt;
&amp;gt;     1&lt;br&gt;
&lt;br&gt;
The 734628 datenum was intended to be the datenum of the _next_ day, so that &lt;br&gt;
now &amp;gt;= 734628 would be true as of the first invalidate time. And under that &lt;br&gt;
(incorrect) supposition, the day May 5, 2011 itself would have been 734627, &lt;br&gt;
which is the prime. The off-by-one was in the original number and thus called &lt;br&gt;
for a correction of the number to 734629 for the purposes of the code.</description>
    </item>
    <item>
      <pubDate>Fri, 30 Jul 2010 19:19:06 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#767259</link>
      <author>Giovanni Ughi</author>
      <description>Walter Roberson &amp;lt;roberson@hushmail.com&amp;gt; wrote in message &amp;lt;i2v5cd$82r$1@canopus.cc.umanitoba.ca&amp;gt;...&lt;br&gt;
&amp;gt; Sean wrote:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Also, that was way more checks than you need for the whole thing.  It &lt;br&gt;
&amp;gt; &amp;gt; could all be done with this condition:&lt;br&gt;
&amp;gt; &amp;gt; %%%&lt;br&gt;
&amp;gt; &amp;gt; if all([c(1)&amp;gt;=2011 c(2) &amp;gt;= 5 &amp;&amp; c(3) &amp;gt; 5])   disp('license expired');&lt;br&gt;
&amp;gt; &amp;gt;   delete myfun.p&lt;br&gt;
&amp;gt; &amp;gt; end&lt;br&gt;
&amp;gt; &amp;gt; %%%&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; if now &amp;gt;= 734628&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; (By the way, the datenum for May 5, 2011 is prime, if someone is looking for a &lt;br&gt;
&amp;gt;   cryptographic obscuration of the above.)&lt;br&gt;
&lt;br&gt;
now and datnum can be easily &quot;modified&quot;. clock is safer</description>
    </item>
    <item>
      <pubDate>Fri, 30 Jul 2010 19:30:22 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#767260</link>
      <author>Giovanni Ughi</author>
      <description>Walter Roberson &amp;lt;roberson@hushmail.com&amp;gt; wrote in message &amp;lt;i2v69h$9a7$1@canopus.cc.umanitoba.ca&amp;gt;...&lt;br&gt;
&amp;gt; Giovanni Ughi wrote:&lt;br&gt;
&amp;gt; &amp;gt; why you said: &quot;just moved to the recycle bin, pretty useless&quot;&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; in my case (winXP and Matlab 2009b) when the file is deleted from matlab &lt;br&gt;
&amp;gt; &amp;gt; is just deleted, I do not have anything in the recycle bin.&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; It may depend on the system settings? (in my case also on different pc &lt;br&gt;
&amp;gt; &amp;gt; it is the same)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Oh gee, somehow the write permissions on the directory disappeared!&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Oh gee, and somehow the ownership of the directory got changed so that the &lt;br&gt;
&amp;gt; permissions couldn't be changed!&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Oh gee, look here, someone overrode the delete function, too...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; The world is littered with the bankrupt remains of software companies who &lt;br&gt;
&amp;gt; thought they had developed &quot;unbreakable&quot; license schemes.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I have only heard of _one_ unbreakable license scheme: it involves quantum &lt;br&gt;
&amp;gt; entanglement and quantum &quot;action at a distance&quot; to create a data stream that &lt;br&gt;
&amp;gt; is unforgeable and unsnoopable (seriously.)&lt;br&gt;
&lt;br&gt;
yes indeed, &lt;br&gt;
&lt;br&gt;
cracks exists from a long time.&lt;br&gt;
&lt;br&gt;
I was just looking for something reasonably safe.&lt;br&gt;
&quot;Clock&quot; is safe enough, but the problem that a user can easily modify the system date and time is not yet fixed.&lt;br&gt;
&lt;br&gt;
Someone can tell me more about that or about any other alternatives?&lt;br&gt;
&lt;br&gt;
thanks</description>
    </item>
    <item>
      <pubDate>Fri, 30 Jul 2010 19:37:04 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#767265</link>
      <author>Andy </author>
      <description>clock can also easily be overloaded.  My point earlier that you should use clock without wrapping it in builtin is that overloading clock is somewhat more likely to have consequences in other MATLAB files.  You could also use both clock and builtin('clock') (that is, check for one or the other) so that the user would have to overload both to get through your time bomb.  The point isn't to make it more secure.  The point is to make it more trouble than it's worth to get around it.</description>
    </item>
    <item>
      <pubDate>Mon, 02 Aug 2010 11:57:05 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#767676</link>
      <author>Giovanni Ughi</author>
      <description>&quot;Sean &quot; &amp;lt;sean.dewolski@nospamplease.umit.maine.edu&amp;gt; wrote in message &amp;lt;i2v5lh$1ao$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Giovanni Ughi&quot; &amp;lt;giovanni.ughi@gmail.com&amp;gt; wrote in message &amp;lt;i2v52r$njt$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; why you said: &quot;just moved to the recycle bin, pretty useless&quot;&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; in my case (winXP and Matlab 2009b) when the file is deleted from matlab is just deleted, I do not have anything in the recycle bin.&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; It may depend on the system settings? (in my case also on different pc it is the same)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Point taken; on my Macintosh with 2009b it just moves it to the trash.  I'd still say overwriting it would be more secure.&lt;br&gt;
&lt;br&gt;
And, how you can overwrite a p-file?</description>
    </item>
    <item>
      <pubDate>Mon, 02 Aug 2010 12:17:05 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#767677</link>
      <author>Steve Amphlett</author>
      <description>&quot;Giovanni Ughi&quot; &amp;lt;giovanni.ughi@gmail.com&amp;gt; wrote in message &amp;lt;i36bqh$l79$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Sean &quot; &amp;lt;sean.dewolski@nospamplease.umit.maine.edu&amp;gt; wrote in message &amp;lt;i2v5lh$1ao$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &quot;Giovanni Ughi&quot; &amp;lt;giovanni.ughi@gmail.com&amp;gt; wrote in message &amp;lt;i2v52r$njt$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; why you said: &quot;just moved to the recycle bin, pretty useless&quot;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; in my case (winXP and Matlab 2009b) when the file is deleted from matlab is just deleted, I do not have anything in the recycle bin.&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; It may depend on the system settings? (in my case also on different pc it is the same)&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Point taken; on my Macintosh with 2009b it just moves it to the trash.  I'd still say overwriting it would be more secure.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; And, how you can overwrite a p-file?&lt;br&gt;
&lt;br&gt;
Open it.&lt;br&gt;
Write some garbage to it.&lt;br&gt;
Close it.</description>
    </item>
    <item>
      <pubDate>Mon, 02 Aug 2010 12:35:24 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#767680</link>
      <author>Giovanni Ughi</author>
      <description>&quot;Steve Amphlett&quot; &amp;lt;Firstname.Lastname@Where-I-Work.com&amp;gt; wrote in message &amp;lt;i36d01$59m$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Giovanni Ughi&quot; &amp;lt;giovanni.ughi@gmail.com&amp;gt; wrote in message &amp;lt;i36bqh$l79$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &quot;Sean &quot; &amp;lt;sean.dewolski@nospamplease.umit.maine.edu&amp;gt; wrote in message &amp;lt;i2v5lh$1ao$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &quot;Giovanni Ughi&quot; &amp;lt;giovanni.ughi@gmail.com&amp;gt; wrote in message &amp;lt;i2v52r$njt$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; why you said: &quot;just moved to the recycle bin, pretty useless&quot;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; in my case (winXP and Matlab 2009b) when the file is deleted from matlab is just deleted, I do not have anything in the recycle bin.&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; It may depend on the system settings? (in my case also on different pc it is the same)&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Point taken; on my Macintosh with 2009b it just moves it to the trash.  I'd still say overwriting it would be more secure.&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; And, how you can overwrite a p-file?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Open it.&lt;br&gt;
&amp;gt; Write some garbage to it.&lt;br&gt;
&amp;gt; Close it.&lt;br&gt;
&lt;br&gt;
I am talking about p-files (matlab pcode to encrypt a m-file).&lt;br&gt;
As far as I know I cannot open and edit them anymore. Or am I wrong?</description>
    </item>
    <item>
      <pubDate>Mon, 02 Aug 2010 13:03:08 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#767686</link>
      <author>us</author>
      <description>&quot;Giovanni Ughi&quot;&lt;br&gt;
&amp;gt; I am talking about p-files (matlab pcode to encrypt a m-file).&lt;br&gt;
&amp;gt; As far as I know I cannot open and edit them anymore. Or am I wrong?&lt;br&gt;
&lt;br&gt;
in general: yes...&lt;br&gt;
however, look at this recent thread...&lt;br&gt;
&lt;br&gt;
&lt;a href=&quot;http://www.mathworks.com/matlabcentral/newsreader/view_thread/271697#713066&quot;&gt;http://www.mathworks.com/matlabcentral/newsreader/view_thread/271697#713066&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
us</description>
    </item>
    <item>
      <pubDate>Mon, 02 Aug 2010 13:31:23 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#767697</link>
      <author>Giovanni Ughi</author>
      <description>&quot;us &quot; &amp;lt;us@neurol.unizh.ch&amp;gt; wrote in message &amp;lt;i36fmc$sdq$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Giovanni Ughi&quot;&lt;br&gt;
&amp;gt; &amp;gt; I am talking about p-files (matlab pcode to encrypt a m-file).&lt;br&gt;
&amp;gt; &amp;gt; As far as I know I cannot open and edit them anymore. Or am I wrong?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; in general: yes...&lt;br&gt;
&amp;gt; however, look at this recent thread...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;a href=&quot;http://www.mathworks.com/matlabcentral/newsreader/view_thread/271697#713066&quot;&gt;http://www.mathworks.com/matlabcentral/newsreader/view_thread/271697#713066&lt;/a&gt;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; us&lt;br&gt;
&lt;br&gt;
this means that you can get info about the variables which are used in the code and relative values (like password values of 12 in that examples)&lt;br&gt;
&lt;br&gt;
not that you can edit and open them. So this means that you can not override a p-file as far as I know.</description>
    </item>
    <item>
      <pubDate>Mon, 02 Aug 2010 13:35:27 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#767701</link>
      <author>Steve Amphlett</author>
      <description>&quot;Giovanni Ughi&quot; &amp;lt;giovanni.ughi@gmail.com&amp;gt; wrote in message &amp;lt;i36e2c$e0p$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Steve Amphlett&quot; &amp;lt;Firstname.Lastname@Where-I-Work.com&amp;gt; wrote in message &amp;lt;i36d01$59m$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &quot;Giovanni Ughi&quot; &amp;lt;giovanni.ughi@gmail.com&amp;gt; wrote in message &amp;lt;i36bqh$l79$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &quot;Sean &quot; &amp;lt;sean.dewolski@nospamplease.umit.maine.edu&amp;gt; wrote in message &amp;lt;i2v5lh$1ao$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &quot;Giovanni Ughi&quot; &amp;lt;giovanni.ughi@gmail.com&amp;gt; wrote in message &amp;lt;i2v52r$njt$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; why you said: &quot;just moved to the recycle bin, pretty useless&quot;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; in my case (winXP and Matlab 2009b) when the file is deleted from matlab is just deleted, I do not have anything in the recycle bin.&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &amp;gt; It may depend on the system settings? (in my case also on different pc it is the same)&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; Point taken; on my Macintosh with 2009b it just moves it to the trash.  I'd still say overwriting it would be more secure.&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; And, how you can overwrite a p-file?&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Open it.&lt;br&gt;
&amp;gt; &amp;gt; Write some garbage to it.&lt;br&gt;
&amp;gt; &amp;gt; Close it.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I am talking about p-files (matlab pcode to encrypt a m-file).&lt;br&gt;
&amp;gt; As far as I know I cannot open and edit them anymore. Or am I wrong?&lt;br&gt;
&lt;br&gt;
You can open any file.  It's unlikely (by design) that the contents of any p-file will be understandable.  But that's not the point.  The point is that overwriting the contents of a file is more secure than attempting to delete it.  Just open it with fopen() and write some crap to it with fwrite() or fprintf().  Then close it.</description>
    </item>
    <item>
      <pubDate>Mon, 02 Aug 2010 13:40:27 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#767704</link>
      <author>us</author>
      <description>&quot;Giovanni Ughi&quot; &amp;lt;giovanni.ughi@gmail.com&amp;gt; wrote in message &amp;lt;i36hbb$fve$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;us &quot; &amp;lt;us@neurol.unizh.ch&amp;gt; wrote in message &amp;lt;i36fmc$sdq$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &quot;Giovanni Ughi&quot;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; I am talking about p-files (matlab pcode to encrypt a m-file).&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; As far as I know I cannot open and edit them anymore. Or am I wrong?&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; in general: yes...&lt;br&gt;
&amp;gt; &amp;gt; however, look at this recent thread...&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &lt;a href=&quot;http://www.mathworks.com/matlabcentral/newsreader/view_thread/271697#713066&quot;&gt;http://www.mathworks.com/matlabcentral/newsreader/view_thread/271697#713066&lt;/a&gt;&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; us&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; this means that you can get info about the variables which are used in the code and relative values (like password values of 12 in that examples)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; not that you can edit and open them. So this means that you can not override a p-file as far as I know.&lt;br&gt;
&lt;br&gt;
well... you can replace/overload a P-file like any other (ML) file as long as you have permission to do so, which depends on the (admin) setup of the folder(s) etc...&lt;br&gt;
&lt;br&gt;
us</description>
    </item>
    <item>
      <pubDate>Mon, 02 Aug 2010 23:07:04 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#767894</link>
      <author>Jan Simon</author>
      <description>Dear Giovanni,&lt;br&gt;
&lt;br&gt;
&amp;gt; I was just looking for something reasonably safe.&lt;br&gt;
&amp;gt; &quot;Clock&quot; is safe enough, but the problem that a user can easily modify the system date and time is not yet fixed.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Someone can tell me more about that or about any other alternatives?&lt;br&gt;
&lt;br&gt;
For Windows:&lt;br&gt;
Get the modification date of the Windows directory.&lt;br&gt;
Either:&lt;br&gt;
&amp;nbsp;&amp;nbsp;FileObj = java.io.File(getenv('WINDIR'));&lt;br&gt;
&amp;nbsp;&amp;nbsp;FileObj.lastModified&lt;br&gt;
(of course you have to convert the numerical format)&lt;br&gt;
Or use a Mex:&lt;br&gt;
&amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/24671&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/24671&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
Of course this is not &quot;secure&quot;: If you run your computer with the wrong date all the time, even the modification dates are wrong.&lt;br&gt;
&lt;br&gt;
Another idea: &lt;br&gt;
Let the user run a file, which checks the output of &quot;!ver&quot; (the version of the OS). Then compare the output in your P-file. Am I right: The version number changes with each patch, and nobody would disable the automatical updates???&lt;br&gt;
&lt;br&gt;
If your program is really expensive, buy a cheap used laptop, install a trial version of Matlab, obfuscate the P-file as much as possible and check all hardware IDs you can access (User-SID, !powercfg /devicequery all_devices_verbose, dates of creation of the hard disks/WIN directory/Matlab installation, etc).&lt;br&gt;
&lt;br&gt;
But finally be aware that some famous manufactures of software do not perfrom such tricks. So perhaps *trust* is the right way.&lt;br&gt;
&lt;br&gt;
Kind regards, Jan</description>
    </item>
    <item>
      <pubDate>Tue, 03 Aug 2010 12:38:06 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#768005</link>
      <author>Andy </author>
      <description>&amp;gt; But finally be aware that some famous manufactures of software do not perfrom such tricks. So perhaps *trust* is the right way.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Kind regards, Jan&lt;br&gt;
&lt;br&gt;
Trust, or a network license manager, which was suggested much earlier and, although more complicated than a time bomb, is probably as secure as you're going to get (or need).</description>
    </item>
    <item>
      <pubDate>Fri, 13 Aug 2010 02:23:06 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#771052</link>
      <author>per isakson</author>
      <description>&quot;us &quot; &amp;lt;us@neurol.unizh.ch&amp;gt; wrote in message &amp;gt; &amp;gt; &amp;gt; &amp;gt; But, if I change the windows &lt;br&gt;
...&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Quick fix: use builtin('clock') to get the current date and time as a datevec, and compare that to your time bomb date.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; well... then the user overloads BUILTIN...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; us&lt;br&gt;
&lt;br&gt;
d = evalc( 'system(''date /T'')' ); &lt;br&gt;
&lt;br&gt;
is that any safer?&lt;br&gt;
&lt;br&gt;
/ per</description>
    </item>
    <item>
      <pubDate>Fri, 13 Aug 2010 02:42:06 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#771054</link>
      <author>per isakson</author>
      <description>&quot;per isakson&quot; &amp;lt;poi.nospam@bimDOTkthDOT.se&amp;gt; wrote in message &amp;lt;i42aaa$ovc$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;us &quot; &amp;lt;us@neurol.unizh.ch&amp;gt; wrote in message &amp;gt; &amp;gt; &amp;gt; &amp;gt; But, if I change the windows &lt;br&gt;
&amp;gt; ...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Quick fix: use builtin('clock') to get the current date and time as a datevec, and compare that to your time bomb date.&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; well... then the user overloads BUILTIN...&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; us&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; d = evalc( 'system(''date /T'')' ); &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; is that any safer?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; / per&lt;br&gt;
&lt;br&gt;
... or &lt;br&gt;
1. create a file &lt;br&gt;
2. get the date modified with DIR&lt;br&gt;
3. delete the file (use RECYCLE to avoid displaying the file in the recycle bin)&lt;br&gt;
&lt;br&gt;
/ per</description>
    </item>
    <item>
      <pubDate>Fri, 13 Aug 2010 03:27:07 -0400</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#771058</link>
      <author>Walter Roberson</author>
      <description>per isakson wrote:&lt;br&gt;
&lt;br&gt;
&amp;gt; d = evalc( 'system(''date /T'')' );&lt;br&gt;
&amp;gt; is that any safer?&lt;br&gt;
&lt;br&gt;
Oh yes, sure, that's fine, we recommend that.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
*giggle*. *snicker*. tee-hee. *snort*</description>
    </item>
    <item>
      <pubDate>Sat, 12 Feb 2011 16:01:03 -0500</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#818890</link>
      <author>Lina Carmen</author>
      <description>Someone wrote about writing in pcode file.If I didnt get it wrong, the user will run the supplied pcode , say mycode.p . How can that file modify itself,while running?&lt;br&gt;
&lt;br&gt;
Is it possible?</description>
    </item>
    <item>
      <pubDate>Wed, 23 Feb 2011 11:50:35 -0500</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#821084</link>
      <author>Matthew Arthington</author>
      <description>&quot;Andy&quot; wrote in message &amp;lt;i2v9l0$jk6$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; clock can also easily be overloaded.  My point earlier that you should use clock without wrapping it in builtin is that overloading clock is somewhat more likely to have consequences in other MATLAB files.  You could also use both clock and builtin('clock') (that is, check for one or the other) so that the user would have to overload both to get through your time bomb.  The point isn't to make it more secure.  The point is to make it more trouble than it's worth to get around it.&lt;br&gt;
&lt;br&gt;
As the builtin clock function has no executable matlab code in its contents, how about reading the clock function to see if there is any executable matlab code in it, like the word eval, or function? &lt;br&gt;
&lt;br&gt;
That would validate whether the code was the original function or not. &lt;br&gt;
&lt;br&gt;
This still doesn't stop the system time from being changed, but it prevents the clock function from being overloaded.</description>
    </item>
    <item>
      <pubDate>Wed, 02 Mar 2011 11:13:06 -0500</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#822632</link>
      <author>JGL </author>
      <description>Why don't you get the date and time from the internet? If you have a web server you can write a php web page that returns the current date and time. Then you can use the urlread function in your program.</description>
    </item>
    <item>
      <pubDate>Wed, 02 Mar 2011 11:25:10 -0500</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#822637</link>
      <author>JGL </author>
      <description>&quot;JGL&quot; wrote in message &amp;lt;ikl8o2$5pv$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Why don't you get the date and time from the internet? If you have a web server you can write a php web page that returns the current date and time. Then you can use the urlread function in your program.&lt;br&gt;
&lt;br&gt;
Then you can also get statistics from your web server and know who is running your program.&lt;br&gt;
&lt;br&gt;
Take into account that the user may be using a proxy, you should set the internet preferences correctly.</description>
    </item>
    <item>
      <pubDate>Wed, 02 Mar 2011 20:10:35 -0500</pubDate>
      <title>Re: protecting MatLab code from being pirated?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260998#822753</link>
      <author>Think two, count blue.</author>
      <description>On 11-03-02 05:13 AM, JGL wrote:&lt;br&gt;
&amp;gt; Why don't you get the date and time from the internet? If you have a web&lt;br&gt;
&amp;gt; server you can write a php web page that returns the current date and time.&lt;br&gt;
&amp;gt; Then you can use the urlread function in your program.&lt;br&gt;
&lt;br&gt;
And somehow protect the interaction from &quot;replay attacks&quot;, including somehow &lt;br&gt;
detecting and protecting against urlread() being overridden, and including &lt;br&gt;
somehow detecting and protecting against the entire validation module being &lt;br&gt;
overridden...</description>
    </item>
  </channel>
</rss>

