www.webdeveloper.com
Results 1 to 15 of 15

Thread: Simple script to hide code

  1. #1
    Join Date
    Jan 2011
    Posts
    6

    Arrow Simple script to hide code

    Here is a simple link to hide your code and encrpyt with one simple click.

    http://www.switchbanks.com.au/webresources.html

  2. #2
    Join Date
    Nov 2010
    Posts
    23
    nice script i'll really try it but do you have any example so please show me i want to see its result

    thank you

  3. #3
    Join Date
    Jan 2011
    Posts
    6
    Would love to show you but the script is encrypted itself it looks like...!!!!!!!! :-) I use it for my website.... for encrypting.. seems fast & effective.

  4. #4
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    Quote Originally Posted by Switching View Post
    Here is a simple link to hide your code and encrpyt with one simple click.

    http://www.switchbanks.com.au/webresources.html
    A simple unescape() will decode your "encrypted" string.

    Forget about hiding your code. There is no reasonable way to hide HTML or JavaScript codes, as the key used for encrypting is open and visible for any average skilled coder.

  5. #5
    Join Date
    Dec 2010
    Posts
    63

    Can you post an example, Kor?

    Can you post an example, Kor?

    Of the unescape() on the encoded string?

    I'm just trying to understand the logic, because the source code reads...

    Code:
    document.write(unescape('%3C%68%74%6D%6C%3E%0D%0A%3C%68%65%61%64%3E%0D%0A%3C%73%63.....etc'));

  6. #6
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    Simple: Let's say I have the following:
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta http-equiv="Content-Style-Type" content="text/css">
    <meta http-equiv="Content-Script-Type" content="text/javascript">
    <script type="text/javascript">
    
    </script>
    </head>
    <body>
    </body>
    </html>
    Now that online application will encrypt the above as a string:
    Code:
    "&#37;3C%21%44%4F%43%54%59%50%45%20%48%54%4D%4C%20%50%55%42%4C%49%43%20%22%2D%2F%2F%57%33%43%2F%2F%44%54%44%20%48%54%4D%4C%20%34%2E%30%31%2F%2F%45%4E%22%20%22%68%74%74%70%3A%2F%2F%77%77%77%2E%77%33%2E%6F%72%67%2F%54%52%2F%68%74%6D%6C%34%2F%73%74%72%69%63%74%2E%64%74%64%22%3E%0A%3C%68%74%6D%6C%3E%0A%3C%68%65%61%64%3E%0A%3C%74%69%74%6C%65%3E%55%6E%74%69%74%6C%65%64%20%44%6F%63%75%6D%65%6E%74%3C%2F%74%69%74%6C%65%3E%0A%3C%6D%65%74%61%20%68%74%74%70%2D%65%71%75%69%76%3D%22%43%6F%6E%74%65%6E%74%2D%54%79%70%65%22%20%63%6F%6E%74%65%6E%74%3D%22%74%65%78%74%2F%68%74%6D%6C%3B%20%63%68%61%72%73%65%74%3D%75%74%66%2D%38%22%3E%0A%3C%6D%65%74%61%20%68%74%74%70%2D%65%71%75%69%76%3D%22%43%6F%6E%74%65%6E%74%2D%53%74%79%6C%65%2D%54%79%70%65%22%20%63%6F%6E%74%65%6E%74%3D%22%74%65%78%74%2F%63%73%73%22%3E%0A%3C%6D%65%74%61%20%68%74%74%70%2D%65%71%75%69%76%3D%22%43%6F%6E%74%65%6E%74%2D%53%63%72%69%70%74%2D%54%79%70%65%22%20%63%6F%6E%74%65%6E%74%3D%22%74%65%78%74%2F%6A%61%76%61%73%63%72%69%70%74%22%3E%0A%3C%73%63%72%69%70%74%20%74%79%70%65%3D%22%74%65%78%74%2F%6A%61%76%61%73%63%72%69%70%74%22%3E%0A%0A%3C%2F%73%63%72%69%70%74%3E%0A%3C%2F%68%65%61%64%3E%0A%3C%62%6F%64%79%3E%0A%3C%2F%62%6F%64%79%3E%0A%3C%2F%68%74%6D%6C%3E"
    That's not a real encrypting, as I can copy that string and use a simple alert to find what lays behind:
    Code:
    <script type="text/javascript">
    alert(unescape("%3C%21%44%4F%43%54%59%50%45%20%48%54%4D%4C%20%50%55%42%4C%49%43%20%22%2D%2F%2F%57%33%43%2F%2F%44%54%44%20%48%54%4D%4C%20%34%2E%30%31%2F%2F%45%4E%22%20%22%68%74%74%70%3A%2F%2F%77%77%77%2E%77%33%2E%6F%72%67%2F%54%52%2F%68%74%6D%6C%34%2F%73%74%72%69%63%74%2E%64%74%64%22%3E%0A%3C%68%74%6D%6C%3E%0A%3C%68%65%61%64%3E%0A%3C%74%69%74%6C%65%3E%55%6E%74%69%74%6C%65%64%20%44%6F%63%75%6D%65%6E%74%3C%2F%74%69%74%6C%65%3E%0A%3C%6D%65%74%61%20%68%74%74%70%2D%65%71%75%69%76%3D%22%43%6F%6E%74%65%6E%74%2D%54%79%70%65%22%20%63%6F%6E%74%65%6E%74%3D%22%74%65%78%74%2F%68%74%6D%6C%3B%20%63%68%61%72%73%65%74%3D%75%74%66%2D%38%22%3E%0A%3C%6D%65%74%61%20%68%74%74%70%2D%65%71%75%69%76%3D%22%43%6F%6E%74%65%6E%74%2D%53%74%79%6C%65%2D%54%79%70%65%22%20%63%6F%6E%74%65%6E%74%3D%22%74%65%78%74%2F%63%73%73%22%3E%0A%3C%6D%65%74%61%20%68%74%74%70%2D%65%71%75%69%76%3D%22%43%6F%6E%74%65%6E%74%2D%53%63%72%69%70%74%2D%54%79%70%65%22%20%63%6F%6E%74%65%6E%74%3D%22%74%65%78%74%2F%6A%61%76%61%73%63%72%69%70%74%22%3E%0A%3C%73%63%72%69%70%74%20%74%79%70%65%3D%22%74%65%78%74%2F%6A%61%76%61%73%63%72%69%70%74%22%3E%0A%0A%3C%2F%73%63%72%69%70%74%3E%0A%3C%2F%68%65%61%64%3E%0A%3C%62%6F%64%79%3E%0A%3C%2F%62%6F%64%79%3E%0A%3C%2F%68%74%6D%6C%3E"));
    </script>

  7. #7
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    Let's take it in a logical way: JavaScript is a scripting client-side language. That means you can not hide the JavaScript code. Or, no matter how sophisticated is the javaScript cryptographic key used, it remains entirely a public key, thus with a little effort, any coder can find, till the end, the encrypting algorithm, as it is always in front of his eyes.

  8. #8
    Join Date
    Jan 2011
    Posts
    6
    Kor I see what you mean - but really if the code is encrypted as it is.... it would have to take awhile to uncrypt surely...????? and who would go to that length.

  9. #9
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    Believe me, it does not worth the effort to encrypt web documents. The users without knowledge or those who don't want to see the code will not do it. Those who want to see the code and have the knowledge: either will do it, because they can, or they will not do it, as they simply don't need anything from that document. It they need, they will decrypt that for sure.

    In all the cases, it does not worth to encrypt anything. It's a waste of time. It's absolutely of no use

  10. #10
    Join Date
    Jul 2003
    Location
    The City of Roses
    Posts
    2,503
    Quote Originally Posted by Switching View Post
    Kor I see what you mean - but really if the code is encrypted as it is.... it would have to take awhile to uncrypt surely...????? and who would go to that length.
    Switching, it actually doesn't take a while at all. It's very quick and very easy. And it doesn't even matter how strong your encryption is. We don't need to know or even think about how to decrypt your code, because your page does this for us. All we need to do is change document.write to alert, and voila.
    for(split(//,'))*))91:+9.*4:1A1+9,1))2*:..)))2*:31.-1)4131)1))2*:3)"'))
    {for(ord){$i+=$_&7;grep(vec($s,$i++,1)=1,1..($_>>3)-4);}}print"$s\n";

  11. #11
    Join Date
    Jan 2011
    Posts
    6
    Okay Thanks Jeff is for that informative info !!!

    If your javascript code is followed by a fomula as shown below


    <script language="JavaScript1.2">
    <!--
    function convert_It(form) {
    var a = escape(form1.first.value); <!-- Get textbox1 string -->
    var b = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ&#37;@#$^&*()-_=+.:"; <!-- letters to compare to -->
    var c = "zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA +=_-)(*&^$#@:."; <!-- letter to change string to -->
    var d;
    var h;
    var i;
    var j = "";

    var f = a.length; <!-- get length of the textbox1 string -->
    var e = 0;
    var g = 1;

    while (e != f) { <!-- while e is not equal to the string length loop -->
    d = a.substring(e,g); <!-- get each letter in the text box -->
    h = b.indexOf(d); <!-- find that letter in var b -->
    i = c.charAt(h); <!-- change it to the letter in var c -->
    e++; <!-- add one to var e -->
    g++; <!-- add one to var g -->
    j += i; <!-- write out each letter -->
    }
    form1.second.value = j; <!-- the final output put in textbox2 -->
    }


    function unconvert_It(form) {
    var aa = form1.second.value;
    var bb = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ @#$^&*()-_=+.:";
    var cc = "zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA +=_-)(*&^$#@:.";
    var dd;
    var hh;
    var ii;
    var jj = "";

    var ff = aa.length;
    var ee = 0;
    var gg = 1;

    while (ee != ff) {
    dd = aa.substring(ee,gg);
    hh = cc.indexOf(dd); <!-- just switch var b with c to unencode ex(h = b.indexOf(d); now ='s hh = cc.indexOf(dd)-->
    ii = bb.charAt(hh); <!-- just switch var c with b to unencode -->
    ee++;
    gg++;
    jj += ii;
    }
    form1.second.value = jj;
    }
    //-->
    </script>

    .....................................................................

    second insert for body as shown below


    <form name="form1" id="form1">
    <textarea cols="40" rows="20" name="first"></textarea>
    <input type="button" name="go" value="Convert" onClick="convert_It(this.form)">
    <input type="button" name="unconvert" value="Unconvert" onClick="unconvert_It(this.form)">
    <textarea cols="40" rows="20" name="second"></textarea>
    </form>

    The un-encryption for that formula above against your

    for(split(//,'))*))91:+9.*4:1A1+9,1))2*:..)))2*:31.-1)4131)1))2*:3)"'))
    {for(ord){$i+=$_&7;grep(vec($s,$i++,1)=1,1..($_>>3)-4);}}print"$s\n";

    is incorrect. Because this is a really basic calculation & still wont give you a result as you have shown.

    ie. Encryption from the code above gives this outcome.

    Hdrgxsrmt X rg zxgfzoob wlvhm g gzpv z dsrov zg zoo: Rg h evib jfrxp zmw evib vzhb: Zmw rg wlvhm g vevm nzggvi sld hgilmt blfi vmxibkgrlm rh: Dv wlm g mvvw gl pmld li vevm gsrmp zylfg sld gl wvxibkg blfi xlwv X yvxzfhv blfi kztv wlvh gsrh uli fh: Zoo dv mvvw gl wl rh xszmtv wlxfnvmg:dirgv gl zovig X zmw elroz:

    Yet if i do the one from Switchbanks with the same writing it gives percentages

    <Script Language='Javascript'>
    <!-- HTML Encryption Switchbanks -->
    <!--
    document.write(unescape('%53%77%69%74%63%68%69%6E%67%2C%20%69%74%20%61%63%74%75%61%6C%6C%79%20%64%6F %65%73%6E%27%74%20%74%61%6B%65%20%61%20%77%68%69%6C%65%20%61%74%20%61%6C%6C%2E%20%49%74%27%73%20%76% 65%72%79%20%71%75%69%63%6B%20%61%6E%64%20%76%65%72%79%20%65%61%73%79%2E%20%41%6E%64%20%69%74%20%64%6 F%65%73%6E%27%74%20%65%76%65%6E%20%6D%61%74%74%65%72%20%68%6F%77%20%73%74%72%6F%6E%67%20%79%6F%75%72 %20%65%6E%63%72%79%70%74%69%6F%6E%20%69%73%2E%20%57%65%20%64%6F%6E%27%74%20%6E%65%65%64%20%74%6F%20% 6B%6E%6F%77%20%6F%72%20%65%76%65%6E%20%74%68%69%6E%6B%20%61%62%6F%75%74%20%68%6F%77%20%74%6F%20%64%6 5%63%72%79%70%74%20%79%6F%75%72%20%63%6F%64%65%2C%20%62%65%63%61%75%73%65%20%79%6F%75%72%20%70%61%67 %65%20%64%6F%65%73%20%74%68%69%73%20%66%6F%72%20%75%73%2E%20%41%6C%6C%20%77%65%20%6E%65%65%64%20%74% 6F%20%64%6F%20%69%73%20%63%68%61%6E%67%65%20%64%6F%63%75%6D%65%6E%74%2E%77%72%69%74%65%20%74%6F%20%6 1%6C%65%72%74%2C%20%61%6E%64%20%76%6F%69%6C%61%2E%20'));
    //-->
    </Script>

  12. #12
    Join Date
    Jan 2011
    Posts
    6
    Also here is another coded section for what i think you are talking about.

    http://javascript.internet.com/passw...ncryption.html
    Last edited by Switching; 01-04-2011 at 05:21 PM. Reason: Update

  13. #13
    Join Date
    Jul 2003
    Location
    The City of Roses
    Posts
    2,503
    The code you saw...

    Code:
    for(split(//,'))*))91:+9.*4:1A1+9,1))2*:..)))2*:31.-1)4131)1))2*:3)"'))
    {for(ord){$i+=$_&7;grep(vec($s,$i++,1)=1,1..($_>>3)-4);}}print"$s\n";
    is part of my signature, not my post. Sorry for the confusion.
    for(split(//,'))*))91:+9.*4:1A1+9,1))2*:..)))2*:31.-1)4131)1))2*:3)"'))
    {for(ord){$i+=$_&7;grep(vec($s,$i++,1)=1,1..($_>>3)-4);}}print"$s\n";

  14. #14
    Join Date
    Jan 2011
    Posts
    6
    Thought you had solved the algorithm in one go..... still there are many different types of encoding and sometimes it seems encryption is worth it even if it is basic. i.e find the shortest path between a set of points (the travelling salesman problem). :-)

    function salesman() {
    this.points = [ [0,0], [10,10], [6,6], [5,6], [3,3], [7,2] ];

    this.distance = function(a, b) {
    var x = Math.abs(a[0] - b[0]);
    var y = Math.abs(a[1] - b[1]);
    return Math. sqrt(x * x + y * y);
    };

    this.fitness = function(values) {
    var used = [this.points.length];
    var length = 0;
    var previous = values[0];
    var a = this.points[previous];
    used[previous] = 1;
    var b = 0;
    for (var i = 1; i < values.length; ++i) {
    b = this.points[values[i]];
    if (used[values[i]] == 1)
    return 1000;
    length += this.distance(a, b);
    previous = values[i];
    used[previous] = 1;
    a = b;
    }
    return length;
    };

    // the size of values that should be passed to fitness
    this.numberOfArgs = function() { return this.points.length; };

    // the max value needed for the arguments
    this.maxArg = function() { return this.points.length; };

    // convert the current chromosome value which can have a maxValue
    // into something fitness can use.
    this.getArg = function(value, maxValue) {
    return Math.round(value * (this.points.length - 1) / maxValue);
    };

    // Paint the solution onto bestimage
    this.paint = function(values) {
    var canvas = document.getElementById('bestimage');
    if (canvas.getContext){
    var w = canvas.width;
    var h = canvas.height;
    var canvasContext = canvas.getContext('2d');
    canvasContext.clearRect(0, 0, w, h);

    // draw points
    for (var i = 0; i < this.points.length; ++i){
    var x = this.points[values[i]][0] * 10;
    var y = this.points[values[i]][1] * 10;
    canvasContext.beginPath();
    canvasContext.arc(x, y, 3, 0, Math.PI*2, true);
    canvasContext.fill();
    }

    // draw path
    canvasContext.beginPath();
    for (var i = 0; i < this.points.length; ++i){
    var x = this.points[values[i]][0] * 10;
    var y = this.points[values[i]][1] * 10;
    if (i == 0)
    canvasContext.moveTo(x, y);
    else
    canvasContext.lineTo(x, y);
    }
    canvasContext.stroke();
    }
    }

    }
    salesman;

  15. #15
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    Switching, once again... maybe you have not understood the nature of the JavaScript language. Your encrypt trials are remarkable, but you have chosen the wrong language. A public key is insecure. JavaScript was not invented for that kind of stuff.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles