Version française
Home     About     Download     Resources     Contact us    
Browse thread
Shared run-time DLLs for commerce
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jon Harrop <jon@f...>
Subject: Re: [Caml-list] Shared run-time DLLs for commerce
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