Option encrypted in Procedures
A procedure with option encrypted that has been loaded from a repository will have its source obfuscated so that it cannot be viewed or debugged. This is useful when you want to share executable code, but do not want the user to see the source implementation.
The first step in creating an encrypted procedure is to add encrypted to the option sequence of the procedure.
f := proc(x) option encrypted; x^2; end proc;
At this point the procedure is not yet encrypted. It must be saved in a repository first. Use the savelib command to save the given procedure. In a subsequent session, if the saved repository has been added to libname, and f is loaded from that repository, then the source code of f can not be viewed.
sq := proc(x) option encrypted; x^2 end proc;
sq ≔ procxoptionencrypted;x^2end proc
The source statements can be seen prior to saving:
Save the procedure named sq:
repo ≔ cat⁡FileTools:-TemporaryDirectory⁡,/mysq.mla:
Now restart your session to clear the current state.
Add your saved repository to libname so you can access the procedure sq
libname ≔ libname,repo:
The procedure can be invoked as usual
But viewing and debugging commands are now disabled:
Error, (in showstat) cannot debug encrypted procedures
Download Help Document