ilikemath2002 Posted February 5, 2009 Share Posted February 5, 2009 I have this code: <script language="JavaScript"> function doencrypt(theform) { if (theform.code.value == "") { alert("No HTML code to encrypt"); return false; } else { enctext=encrypt(theform.code.value); codetocopy="<Script Language='Javascript'>\n"; codetocopy+="<!-- HTML Encryption -->\n"; codetocopy+="<!--\n"; codetocopy+="document.write(unescape('"+enctext+"'));\n"; codetocopy+="//-->\n"; codetocopy+="</Script\>"; theform.ecode.value=codetocopy; theform.sac.disabled = false; } return false; } function sandc(thisform) { thisform.ecode.focus(); thisform.ecode.select(); copytext=thisform.ecode.createTextRange(); copytext.execCommand("Copy"); alert("Copied the Encrypted HTML Code to clipboard, you may now paste this into your website"); } function encrypt(tx) { var hex=''; var i; for (i=0; i<tx.length; i++) { hex += '%'+hexfromdec(tx.charCodeAt(i)) } return hex; } function hexfromdec(num) { if (num > 65535) { return ("err!") } first = Math.round(num/4096 - .5); temp1 = num - first * 4096; second = Math.round(temp1/256 -.5); temp2 = temp1 - second * 256; third = Math.round(temp2/16 - .5); fourth = temp2 - third * 16; return (""+getletter(third)+getletter(fourth)); } function getletter(num) { if (num < 10) { return num; } else { if (num == 10) { return "A" } if (num == 11) { return "B" } if (num == 12) { return "C" } if (num == 13) { return "D" } if (num == 14) { return "E" } if (num == 15) { return "F" } } } </script> <form name="pageform" onsubmit="return doencrypt(this);"> I basically want to encrypt whole files at a time without having to enter the source code, is this possible? Quote Link to comment Share on other sites More sharing options...
webster08 Posted February 5, 2009 Share Posted February 5, 2009 are you trying to encrypt your JS source code; is that what your wanting? Quote Link to comment Share on other sites More sharing options...
ilikemath2002 Posted February 5, 2009 Author Share Posted February 5, 2009 No, this is javascript code to encrypt HTML. I thought this was the right forum. Quote Link to comment Share on other sites More sharing options...
webster08 Posted February 5, 2009 Share Posted February 5, 2009 so your wanting to encrypt your html source code? Quote Link to comment Share on other sites More sharing options...
webster08 Posted February 5, 2009 Share Posted February 5, 2009 oh, i see; your wanting to encrypt your form submission results. well if that is what your trying to do; i would forget about doing it with javascript. because js can be disabled; hence "no more form submission encryption". your best bet is to place the page (that contains the form) in a SSL folder. Quote Link to comment Share on other sites More sharing options...
ilikemath2002 Posted February 5, 2009 Author Share Posted February 5, 2009 I don't think you understand. You input HTML source-code, and the Javascript encrypts it to Javascript. I want to input whole files(get the source-code from that file). I know Javascript can be disabled AND this can be decrypted, but I still would like to use it. Quote Link to comment Share on other sites More sharing options...
webster08 Posted February 5, 2009 Share Posted February 5, 2009 then here would be a good place to start your research: http://www.google.com/#hl=en&ei=c3iLSaqlFIH8tgfjlPmTBw&sa=X&oi=spell&resnum=1&ct=result&cd=1&q=Source+Code+Encryption&spell=1&fp=3WTwdsC3GPc Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.