Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Jon Harrop <jon@ffconsultancy.com>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Shared run-time DLLs for commerce
Date: Tue, 8 Jan 2008 18:35:53 +0000	[thread overview]
Message-ID: <200801081835.53398.jon@ffconsultancy.com> (raw)
In-Reply-To: <20080108160351.GB4410@annexia.org>

On Tuesday 08 January 2008 16:03:51 Richard Jones wrote:
> On Mon, Jan 07, 2008 at 07:51:23PM +0000, Jon Harrop wrote:
> > On Monday 07 January 2008 15:54:45 Alain Frisch wrote:
> > > 1. Distribute the source code, even without an open source license. I
> > > cannot imagine this would reduce your sales, but you know better.
> >
> > Yes. The concern here is not loss of sales but loss of competitive edge.
> > With direct access to a comprehensible implementation of the complex
> > algorithms inside the software, people will nick the algorithms even if
> > they don't nick the source code. After 9 years of work, I'd rather not
> > see that happen... :-)
>
> Really?  Do you think that the generated bytecode is obscure enough to
> protect this 'valuable' knowledge too?

I value the little protection that it provides.

> If I was that concerned about 
> my cherished algorithms, I wouldn't let them go beyond a web service.

For implementations that can be hidden in that way, it would be fine, but this 
is high-performance OpenGL-based visualization so a web service is a no-go.

> > > 3. Obfuscate the parts of the source code you want to keep secret.
> > > Camlp4 might help here.
> >
> > This is a possibility but there is little scope for obfuscation within
> > OCaml, AFAIK. I really want to distribute after pattern match
> > compilation, for example.
>
> Check out this recent discussion on ocaml_beginners:
>
> http://tech.groups.yahoo.com/group/ocaml_beginners/message/9163

Actually that is an excellent example of source code obfuscation being 
inadequate in OCaml because you can reverse engineer the code into a 
developable form using only camlp4:

$ camlp4oof bf.ml
let (i, f) = (input_char, (open_in Sys.argv.(1)))
let rec p (c, b, k) =
  try
    p
      (match i f with
       | '+' -> ((c + 1), b, k)
       | '-' -> ((c - 1), b, k)
       | '<' ->
           (match b with
            | ([], r) -> (0, ([], (c :: r)), k)
            | (h :: l, r) -> (h, (l, (c :: r)), k))
       | '>' ->
           (match b with
            | (l, []) -> (0, ((c :: l), []), k)
            | (l, h :: r) -> (h, ((c :: l), r), k))
       | '[' ->
           if c = 0
           then (while (i f) <> ']' do () done; (c, b, k))
           else (c, b, (((pos_in f) - 1) :: k))
       | ']' ->
           (match k with
            | [] -> failwith "]"
            | h :: t -> (seek_in f h; (c, b, t)))
       | ',' -> ((input_byte stdin), b, k)
       | '.' -> (output_byte stdout c; (c, b, k))
       | _ -> (c, b, k))
  with | _ -> ()
let _ = p (0, ([], []), [])

On the other hand, reverse engineering non-trivial pattern matches after 
compilation would require substantially more work for someone with no 
relevant expertise.

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/products/?e


  reply	other threads:[~2008-01-08 18:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-07 11:30 Jon Harrop
2008-01-07 13:03 ` [Caml-list] " Alain Frisch
     [not found]   ` <200801071503.26977.jon@ffconsultancy.com>
2008-01-07 15:54     ` Alain Frisch
2008-01-07 17:32       ` Kuba Ober
2008-01-07 19:51       ` Jon Harrop
2008-01-07 21:17         ` Stefano Zacchiroli
2008-01-08 19:39           ` Christophe TROESTLER
2008-01-08 19:42             ` Jon Harrop
2008-01-08 20:18               ` Richard Jones
2008-01-08 16:03         ` Richard Jones
2008-01-08 18:35           ` Jon Harrop [this message]
2008-01-09  9:17         ` Alain Frisch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200801081835.53398.jon@ffconsultancy.com \
    --to=jon@ffconsultancy.com \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox