2
$\begingroup$

Possible Duplicate:
How to distribute proprietary Mathematica code

I suspect that there is a way to expose the down values of such symbols with an attack along these lines:

Unprotect[SetAttributes, Set, Attributes]
SetAttributes[sym_, att_Symbol] /; MemberQ[{Locked, ReadProtected}, att] := Null
SetAttributes[sym_, atts_List] /;  MemberQ[atts, (Locked | ReadProtected)] := 
 SetAttributes[sym, DeleteCases[atts, (Locked | ReadProtected)]]
Attributes /: Set[Attributes[sym_], att_Symbol] /; 
  MemberQ[{Locked, ReadProtected}, att] := Null
Attributes /: Set[Attributes[sym_], atts_List] /; 
  MemberQ[atts, (Locked | ReadProtected)] := 
 SetAttributes[sym, DeleteCases[atts, (Locked | ReadProtected)]]
Protect[SetAttributes, Set, Attributes];

Can anyone recover the down values of this MrE[] function if you load "FindMeEncoded.m" into a fresh kernel?

MrE[x_] := With[{y = "you found me!!!!"}, ToString[x] ~~ ": you can't find me"]
SetAttributes[MrE, ReadProtected]
SetAttributes[MrE, Locked]
Save["FindMe.m", MrE]
Encode["FindMe.m", "FindMeEncoded.m"]
$\endgroup$
  • $\begingroup$ Strongly related question (I'd consider it a dupe):mathematica.stackexchange.com/q/1571/5 The gist is that while it is reasonably safe, it can be circumvented. Using the above with DumpSave gives you greater "security", but you lose out on cross-platform compatibility, since you'll have to maintain different versions for each platform/architecture. The general sentiment among those that know how to disable lock and circumvent it was that such knowledge should not be shared in public (these statements are in now deleted answers and comments) $\endgroup$ – rm -rf Jul 21 '12 at 21:09

Browse other questions tagged or ask your own question.