Apr 7th, 2008 23:02
ha mo, Mark Szlazak, Mark Szlazak, Jean-Bernard Valentaten, Colin Fraser,
may look for programs that will prevent users from downloading your page
in a useable format. Microsoft has such a program, they use it on their
site, and I am sure there is one around to suit your need.
Well, basically it can be done, at least the decryption is doable using
least save them in an encrypted format on your web server. Compression
could be done too but I really wouldn't want to do it since it involves
a lot of coding, thus not really giving you a benefit on the traffic.
All you'll need is an algorithm that is not a one-way encryption
(invent one *g*), a blank page only containig the header and the
decrypt function. It might look like this:
var sDecryptedBody = '';
//decrypt the body string here, e.g.:
for (var i=0; i<sBody.length; i++)
var iChar = sBody.charCodeAt(i);
if (iChar > 0)
sDecryptedBody += String.fromCharCode(iChar - 1);
sDecryptedBody += String.fromCharCode(255);
var sCoded = document.getElementsByTagName('body')
<!-- Place the encrypted document here -->
That should do the trick. All the user will see when she views the
sourcecode is your blank document, containing the decode and decrypt
function in the header and some garbage in the body. But be aware that
any skilled person will be able to reproduce the decryption algorithm
and thus view the real sourcecode!!!
Thanks for responding. The sites I found have very limited and/or slow
have a different approach using a very long regular expression which is
more extensive, orders of magnitude faster, and done with little
reading/file writing/interface source.
See this pages commented source:
Note that obfuscation in this context does not mean encoding and
decoding. Just removing comments, whitespace, etc. obfuscates the
source. But what I mean is replacing identifier/variable names with
shorter versions to further compression. No decoding is required but
only properly running script after the replacement. This code is a bit
longer and slower but not as long as many may think.
I may post the shorter version but to understand its "trick" requires
some explanation which maybe too long to post here.