Onur Baser <[email protected]> asks,
> Is there anyway to hide the content of do file or ado file?
>
> I want to send the stata code to the client, he can run it and see
> the output, but I dont want to see him the algorithms in it etc.
There is nothing built-in to Stata to hide the contents of do- and ado-files.
The current thinking at StataCorp is that those files are "open" and,
if code needs to be hidden, it will be written in Mata or in C, where the
decision to distribute the source code is up to the user.
If we're talking about one simple ado-file or do-file, translating to
Mata is probably the way to go. Remember, Mata can issue Stata commands via
the stata() function.
If we're talking about a large system where translation is unreasonable,
there is a second-best approach, but it requires writing a fair amount of
wrapper code in Mata and, unless one goes to a lot of work, the result
will not be really secure. The gist of it is
1. Distribute ado-code in an encrypted form, said encrypted form
to be created by Mata routines you write.
2. When the user executes the code, the first step will be to
decrypt (1).
3. The decrypted code will then execute.
4. Erase the decrypted versions.
I say "a lot of work", but in fact, it is probably not as much work as you
would expect. On the side, I started to outline the details, and I would
guess that it would take 100 to 200 lines of code in Mata.
There are, however, two issues with this approach: How good you make the
encryption routine and, however good you make it, that the user will be able
to look at the decrypted version (and presumably make a copy) while the
routines are running.
-- Bill
[email protected]
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/