Encrypted Procedures
Maple 2018 lets you encrypt procedures. An encrypted procedure acts and behaves like any normal procedure in Maple, but it can not be viewed or debugged. This provides a way for professional users to share executable procedures while protecting their IP.
The following defines a procedure that implements a block game as described at "http://rosettacode.org/wiki/ABC_Problem#Maple". The procedure is then saved into a repository file called "abc.mla".
After executing the code above we can call the canSpell procedure to test what words can be spelled with the given blocks.
canSpellbox;
true
canSpellxoxox;
false
Normally the statements of a procedure can be seen via commands such as showstat and eval in Maple. This is true for this procedure too because it was just defined. Note: option encrypted only takes full effect when the procedure is loaded from a library, not when it was just entered from source.
evalcanSpell;
procwoptionencrypted;localblocks,i,j,word,found,N;blocks ≔ Array⁡B,O,K,X,D,Q,C,P,A,N,J,W,H,U,I,V,A,N,B,O,G,T,E,R,G,T,D,Q,F,S,E,R,F,S,L,Y,C,P,M,Z;word ≔ StringTools:-UpperCase⁡convert⁡w,string;N ≔ numelems⁡blocks;foritolength⁡worddofound ≔ false;forjtoNdoifword[i]inblocks[j]thenblocks[j] ≔ blocks[N];N ≔ N − 1;found ≔ true;breakend ifend do;ifnotfoundthenreturnfalseend ifend do;returntrueend proc
Let's restart and then reference the procedure from the "abc.mla" repository that we saved it in:
restart;
libname ≔ libname,catFileTools:-TemporaryDirectory,/abc.mla:
We can use the procedure:
canSpellgood;
But we can no longer see the implementation:
procwoptionencrypted;localblocks,i,j,word,found,N;2f0b0404264baa44a4bc758aa04e5b18e763f64743733b1443d884fbae3db43aa9f7602fc86ade456f648e4965c66765bc9ae483a741f33e7906cb36c2c9f8d8571c607892e334a524080dc68f96c7ee03127724368a0b44518f210cc61a58ef47668d7415828c6e4de386370634e04754d32a723d154802511873d5b144d08ba5c8d544356a5126d8d39e047de4fb7251107155148450fca5c8d5443d6a51265be4a391eb29d40e51197165d872d08ba5c8d5443a6a512690f1bf332a8a69ef511a71556c8450fc402c48ce1744215c81a7ede7e8baefb3a5c8d544396a5126208cee0573051de2ff10f544e08e25c34119983289241252bdbc456f5124c54684d0a607a99430dae81d6220cc795ad05e54c1fe2ab47fa3d4b4515eb853703920a8ac666e690a744934462441290b6e62016dc6f0f1d3dc45b49f2d356d666ebcf3c846116cc4ef57d407aeef5ccc29c3c4a776c0780b78a86eabbfffc16dc83ceb6e4776963171fe468b8fde1fcfbbe01d9f706c057c45b2803d6931787b36c93468625240bced45e82c676e653427f554f621d038706303149886f5921caac96f01288b3e65433f340647989334611766b05d3938b5f3e7454c42c6377bade609147920fb7524357aa946133c235b6c5f0da1705c06234890d7203931aee0dcbdb9463b07c955262c3767463e376773c1580fd747af44f886db6e4e5d4e213c1858365a9155f3464d8865464f286496b060ab4849d13be286ee895dccbb34b5702271feedf925a0f3ae271bde5e8fb3a23115a91b68450ee0363559c35c9c2fb90e0dd5e19e0855ee6f1ee160d3cf42214a72f881889b6a12a672e9a4ac901c586a522fc4ada9b3a23115a91b6845501e43e0ce2a70a605f8e546c8e73d0c77b6167d1e940cf63b204a72fd818c2b6a12a672e9a4ac90eb8a55f4090fbbbdf5c67915591b68475fca58199eeb812588b80bba9b3f503cefcfecb90abb19ad3fa65273f881bc1342d8283a711dac4975a663a6467186466c4669989d283f7116f3b81d3d4e4fafend proc
For more information, see encrypted.
Download Help Document