Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'll be quite to the point, is there any way to make Javascript a bit more concealed than it usually is or is Javascript always out and open if you look in the source code ?

This is about hiding proprietary algorithms that would dispense a service that does not exist yet (to my knowledge) on the market and is not really straightforward. I know that patenting is possible but let's leave this out of the question.

share|improve this question
1  
Is there a way to keep the algorithm on the server side? Even a partial split of algorithm steps between client and server will be sufficient to thwart reverse engineering. (On the other hand, don't underestimate the creativity of the world - it is not that difficult for another inventor to independently arrive at the same algorithm.) –  rwong Jan 13 '13 at 2:00
    
Obfuscation, FTW! –  Jim G. Jan 13 '13 at 2:13
    
Bah. The thing with obfuscation is that some people are experts and particularly those who love reverse engineering. It's just more fun to those guys. –  Alexandre P. Levasseur Jan 13 '13 at 2:15
    
Related from SO: stackoverflow.com/questions/4189245/… –  apsillers Jan 13 '13 at 3:21
    
and: stackoverflow.com/questions/6159875/… –  haylem Jan 14 '13 at 11:06
add comment

1 Answer 1

up vote 12 down vote accepted

Well you can "obfuscate" the code by removing all recognizable names that are not essential to the working of the code. (And minification is a good approximation to obfuscation.)

However, the fact remains that Javascript must be delivered (to the user's browser) as source code that is ultimately compilable and executable by the browser. That means that someone who controls the browser will always be able to reverse engineer any "secrets" embedded in the code ... and that includes secret algorithms.

(Incidentally, this applies to ALL methods of delivering algorithms. If you don't control the execution platform, any mechanism for protecting or hiding a secret algorithm can be broken ... given sufficient time and motivation.)


The solution is to not embed the algorithms. Keep them server side and have the browser make a call to the server to run them.

Alternatively, use a legal solution: require all users to sign a legally enforceable agreement that has "teeth" ... and enforce it vigorously! (WARNING: this won't make you popular with your users ...)

share|improve this answer
    
So ultimately I'd better take a little more time and develop my solution using mostly PHP and use only Javascript for the essential JS stuff. That's what I thought but I wanted to make sure. I'll just wait a bit before allowing check mark but it does seem like the answer I needed. –  Alexandre P. Levasseur Jan 13 '13 at 2:09
2  
Or you can run JavaScript on the server side. –  James McLeod Jan 13 '13 at 19:07
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.