MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How to hide mathematica code?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg64489] Re: How to hide mathematica code?
  • From: albert <awnl at arcor.de>
  • Date: Sun, 19 Feb 2006 05:35:57 -0500 (EST)
  • References: <200602170911.EAA00691@smc.vnet.net> <dt6kn6$nh2$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

> I think the answer is yes (with one reservation). Here is an example:
> 
> In[1]:=
> f[x_]:=x^2;
> 
> In[2]:=
> SetAttributes[f,{Locked,Protected,ReadProtected}]
> 
> In[3]:=
> DumpSave["f.mx",f];
> 
> Now quite the kernel and read in the file "f.mx".
> 
> In[1]:=
> << "f.mx"
> 
> In[2]:=
> f[2]
> 
> Out[2]=
> 4
> 
> In[3]:=
> ?f
> 
> Global`f
> 
> Attributes[f] = {Locked, Protected, ReadProtected}
> 
> Opening the file f.mx also does not reveal any information about f.
> The only problem is that the file f.mx is not portable to a different
> platform.
Instead of using a binary dump you could use Encode[] to encode the
package-file. Then you can use the regular Get or Needs-constructs to load
the package. Encode should generate to a portable package which is still
not readable. I am not sure whether that is still true, but I remember that
for at least version 4 encoded packages were portable between Linux and
Windows when encoded in Linux, but not when encoded in Windows. I don't
know about Macs and other Unices for sure, but that's something that the
support at Wolfram's should be able to answer if it is a matter for you. 

hth,

albert


  • Prev by Date: Re: Using a text editor like interface for Mathematica?
  • Next by Date: Re: Showing Animation Outputs together
  • Previous by thread: Re: How to hide mathematica code?
  • Next by thread: Re: How to hide mathematica code?