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: [mg64488] Re: [mg64431] How to hide mathematica code?
  • From: Jean-Marie Thomas <jmt at nerim.net>
  • Date: Sun, 19 Feb 2006 05:35:56 -0500 (EST)
  • References: <200602170911.EAA00691@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

On Friday 17 February 2006 10:11, Alexander wrote:
> Dear Mathgroup!
>
> Is there any possibility to define a function and hide it's implementation?
> The answer seems to be "no".
>
> Alexander.

Three necessary steps :

1 - The code you want to hide must reside in a package, i.e. hidden code 
functionalities will be accessible to your users via a
Needs["HiddenCode"] or a Get["HiddenCode"] or a <<"HiddenCode"

This implies you have to write and document your code juste like any library 
is written and documented.

2 - Elements in your library that are exported should have the attribute 
"ReadProtected" set. Consequently, the Mathematica code used to define your 
objects cannot be read. 

3 - Finally, the file "HiddenCode.m" containing your code should be encrypted 
via the built-in function Encode. You can add further restrictions : Encode 
in respect to a certain key or to a certain machine for instance.

While some weakness in this model might still exist (I don't see how for 
instance the value of a private variable is hidden by this mechanism - but I 
admit I did not investigate the subject), in pratice it is rock solid, 
transparent to your users, and easy to implement.

jmt


  • Prev by Date: Re: SetOptions with Column
  • Next by Date: LeftClick+Shift+Enter Reassign
  • Previous by thread: Re: How to hide mathematica code?
  • Next by thread: Re: How to hide mathematica code?