Re: protecting Mathematica notebooks/source code from piracy
- To: mathgroup at smc.vnet.net
- Subject: [mg103500] Re: protecting Mathematica notebooks/source code from piracy
- From: David Bailey <dave at removedbailey.co.uk>
- Date: Fri, 25 Sep 2009 05:57:47 -0400 (EDT)
- References: <h9eqdt$d51$1@smc.vnet.net>
stpatryck wrote: > Hello All, > > I tried searching this group's archives for ways of protecting > Mathematica notebooks and source code from piracy and/or > modification. I didn't find anything, so I'm wondering if there are > ways to do it. > > Any suggestions or advice would be appreciated. > > Thanks in advance. > The best way is to transfer your code to a .m (package) file. These files can be edited from within Mathematica almost like notebooks, but their external structure is simpler, and they can be read with Get. They can also be encoded with Encode with or without a specific key. The encoded file can't be decoded (so take care not to encode your only copy!) but it can be read with Get - see the documentation for details. You should also set the Locked and ReadProtected attributes on the code (within the .m file) so that the result can't be examined using ?<Symbol> I have some reservations about Encode if you need to protect against really serious hackers. I discovered that if you encode two files that differ by one byte, the encoded results only differ over 4 consecutive bytes. This suggests to me that the encoding technique is relatively weak (I didn't try the case where a key is used). My guess is that this function was written in the days when the US was placing restrictions on the export of software containing strong encryption. Once released in this form, I imagine it had to continue to use the same method for consistency. David Bailey http://www.dbaileyconsultancy.co.uk