Professional Web Applications Themes

Encrypt in Perl, De-encrypt in Javascript - PERL Miscellaneous

I got a javascript off the net which encrypt and de-encrypt HTML code so that nobody can read the public html file. here is the code of javascript and html. what i want to do is to encrypt in perl then de-encrypt in javascript, because the original code is doing encrypting and de-encrypting both in javascript. the js file: var enkripsi="'1AQAPKRV'1G'2F'2C'02'02'02'02'02'02'02' 02dwlavkml'02glipkr'0:dmpo l{c'0;'02'5'2F'2C'2F'2C'02'02'02'02'02'02'02'02'0 2'02'02'02tcp'02imfg3'02'1 F'02gqacrg'0:dmpol{c,imfgcucn,tcnwg'0;'1'2F'2C'02 '02'02'02'02'02'02'02'02'0 2'02'02tcp'02imfg0'1F'00'00'1'2F'2C'02'02'02'02'0 2'02'02'02'02'02'02'02tcp' 02fmr'1F'00'00'1'2F'2C'02'02'02'02'02'02'02'02'02 '02'02'02tcp'02ig{'02'1F'0 2dmpol{c,rcpcogvgp,tcnwg'1'2F'2C'02'02'02'02'02'0 2'02'02'02'02'02'02tcp'02r clhcle'02'1F'02imfg3,nglevj'1'2F'2C'02'02'02'02'0 2'02'02'02'02'02'02'02dmp' 02'0:k'1F2'1k'1Arclhcle'1k))'0;'02'02'5'2F'2C'0 2'02'02'02'02'02'02'02'02' 02'02'02'02'02'02'02kd'02'0:dmpol{c,ogvmfg,tcnwg'1 F'1F'00iwpcle'00'0;'02'5' 2F'2C'02'02'02'02'02'02'02'02'02'02'02'02'02'02'02 '02'02'02'02'02imfg0)'1FQv pkle,dpmoAjcpAmfg'0:imfg3,ajcpAmfgCv'0:k'0;/ig{'0;'1'2F'2C'02'02'02'02'02'0 2'02'02'02'02'02'02'02'02'02'02'02'02'02'02fmr'1F' 00)'00'1'2F'2C'02'02'02'0 2'02'02'02'02'02'02'02'02'02'02'02'02'5F'2F'2C'02' 02'02'02'02'02'02'02'02'02 '02'02'02'02'02'02gnqg'2F'2C'02'02'02'02'02'02'02' 02'02'02'02'02'02'02'02'02 '02'02'02'02kd'0:dmpol{c,ogvmfg,tcnwg'1F'1F'00vco` cj'00'0;'02'5'2F'2C'02'02 '02'02'02'02'02'02'02'02'02'02'02'02'02'02'02'02'0 2'02'02'02'02'02imfg0)'1FQ vpkle,dpmoAjcpAmfg'0:imfg3,ajcpAmfgCv'0:k'0;)ig{'0 ;'1'2F'2C'02'02'02'02'02' 02'02'02'02'02'02'02'02'02'02'02'02'02'02'02'02'02 '02'02fmr'1F'00/'00'1'2F' 2C'02'02'02'02'02'02'02'02'02'02'02'02'02'02'02'02 '02'02'02'02'5F'2F'2C'02'0 2'02'02'02'02'02'02'02'02'02'02'02'02'02'02'02'02' 02'02gnqg'2F'2C'02'02'02'0 2'02'02'02'02'02'02'02'02'02'02'02'02'02'02'02'02' ...

  1. #1

    Default Encrypt in Perl, De-encrypt in Javascript

    I got a javascript off the net which encrypt and de-encrypt HTML code so
    that nobody can read the public html file.

    here is the code of javascript and html. what i want to do is to encrypt in
    perl then de-encrypt in javascript, because the original code is doing
    encrypting and de-encrypting both in javascript.

    the js file:
    var
    enkripsi="'1AQAPKRV'1G'2F'2C'02'02'02'02'02'02'02' 02dwlavkml'02glipkr'0:dmpo
    l{c'0;'02'5'2F'2C'2F'2C'02'02'02'02'02'02'02'02'0 2'02'02'02tcp'02imfg3'02'1
    F'02gqacrg'0:dmpol{c,imfgcucn,tcnwg'0;'1'2F'2C'02 '02'02'02'02'02'02'02'02'0
    2'02'02tcp'02imfg0'1F'00'00'1'2F'2C'02'02'02'02'0 2'02'02'02'02'02'02'02tcp'
    02fmr'1F'00'00'1'2F'2C'02'02'02'02'02'02'02'02'02 '02'02'02tcp'02ig{'02'1F'0
    2dmpol{c,rcpcogvgp,tcnwg'1'2F'2C'02'02'02'02'02'0 2'02'02'02'02'02'02tcp'02r
    clhcle'02'1F'02imfg3,nglevj'1'2F'2C'02'02'02'02'0 2'02'02'02'02'02'02'02dmp'
    02'0:k'1F2'1k'1Arclhcle'1k))'0;'02'02'5'2F'2C'0 2'02'02'02'02'02'02'02'02'
    02'02'02'02'02'02'02kd'02'0:dmpol{c,ogvmfg,tcnwg'1 F'1F'00iwpcle'00'0;'02'5'
    2F'2C'02'02'02'02'02'02'02'02'02'02'02'02'02'02'02 '02'02'02'02'02imfg0)'1FQv
    pkle,dpmoAjcpAmfg'0:imfg3,ajcpAmfgCv'0:k'0;/ig{'0;'1'2F'2C'02'02'02'02'02'0
    2'02'02'02'02'02'02'02'02'02'02'02'02'02'02fmr'1F' 00)'00'1'2F'2C'02'02'02'0
    2'02'02'02'02'02'02'02'02'02'02'02'02'5F'2F'2C'02' 02'02'02'02'02'02'02'02'02
    '02'02'02'02'02'02gnqg'2F'2C'02'02'02'02'02'02'02' 02'02'02'02'02'02'02'02'02
    '02'02'02'02kd'0:dmpol{c,ogvmfg,tcnwg'1F'1F'00vco` cj'00'0;'02'5'2F'2C'02'02
    '02'02'02'02'02'02'02'02'02'02'02'02'02'02'02'02'0 2'02'02'02'02'02imfg0)'1FQ
    vpkle,dpmoAjcpAmfg'0:imfg3,ajcpAmfgCv'0:k'0;)ig{'0 ;'1'2F'2C'02'02'02'02'02'
    02'02'02'02'02'02'02'02'02'02'02'02'02'02'02'02'02 '02'02fmr'1F'00/'00'1'2F'
    2C'02'02'02'02'02'02'02'02'02'02'02'02'02'02'02'02 '02'02'02'02'5F'2F'2C'02'0
    2'02'02'02'02'02'02'02'02'02'02'02'02'02'02'02'02' 02'02gnqg'2F'2C'02'02'02'0
    2'02'02'02'02'02'02'02'02'02'02'02'02'02'02'02'02' 02'02'02'02kd'0:dmpol{c,og
    vmfg,tcnwg'1F'1F'00zmp'00'0;'02'5'2F'2C'02'02'02' 02'02'02'02'02'02'02'02'02
    '02'02'02'02'02'02'02'02'02'02'02'02'02'02'02'02im fg0)'1FQvpkle,dpmoAjcpAmfg
    '0:imfg3,ajcpAmfgCv'0:k'0;'7Gig{'0;'1'2F'2C'02'02 '02'02'02'02'02'02'02'02'0
    2'02'02'02'02'02'02'02'02'02'02'02'02'02'02'02'02' 02fmr'1F'00'7G'00'1'2F'2C
    '02'02'02'02'02'02'02'02'02'02'02'02'02'02'02'02'0 2'02'02'02'02'02'02'02'5F'
    2F'2C'02'02'02'02'02'02'02'02'02'02'02'02'5F'2F'2C '2F'2C'02'02'02'02'02'02'0
    2'02'02'02'02'02tcp'02fgipkrqkl{c'02'1F'02'2F'2C'0 2'02'02'02'02'02'02'02'02'
    02'02'02'05tcp'02glipkrqk'1F'00'05)imfg0)'05'00'1 '02vgiq'1F'00'00'1'02vgiq
    cqnk'1F'00'00'1'05)'2F'2C'02'02'02'02'02'02'02'02 '02'02'02'02'05tcp'02rclhc
    le'1'05)'2F'2C'02'02'02'02'02'02'02'02'02'02'02'0 2'05rclhcle'1Fglipkrqk,ngl
    evj'1'05)'2F'2C'02'02'02'02'02'02'02'02'02'02'02' 02'05dmp'02'0:k'1F2'1k'1A
    rclhcle'1k))'0;'05)'02'2F'2C'02'02'02'02'02'02'02 '02'02'02'02'02'05'5'02vg
    iq)'1FQvpkle,dpmoAjcpAmfg'0:glipkrqk,ajcpAmfgCv'0: k'0;'05)fmr)ig{)'05'0;'02'
    5F'05)'2F'2C'02'02'02'02'02'02'02'02'02'02'02'02'0 5vgiqcqnk'1Fwlgqacrg'0:vgi
    q'0;'1'05)'2F'2C'02'02'02'02'02'02'02'02'02'02'02 '02'05fmawoglv,upkvg'0:vgi
    qcqnk'0;'1'05'1'2F'2C'02'02'02'02'02'2F'2C'02'02 '02'02'02'02'02'02'02'02'0
    2'02--'02dmpol{c,jcqkn,tcnwg'1F'05'7A'1AQAPKRV'7A'1G'05) fgipkrqkl{c)'05'7A'1
    A-QAPKRV'7A'1G'05'1'2F'2C'02'02'02'02'02'02'02'02'0 2'02'02'02dmpol{c,jcqkn,
    tcnwg'1Ffgipkrqkl{c'1'2F'2C'02'02'02'02'02'2F'2C' 02'02'02'02'02'02'02'02'02
    '02'02'02kd'02'0:dmpol{c,rpgtkgu,tcnwg'1F'1F'00[c'00'0;'02'5'2F'2C'02'02'02
    '02'02'02'02'02'02'02'02'02'02'02'02'02jclfng'1Fuk lfmu,mrgl'0:'0;'1'2F'2C'0
    2'02'02'02'02'02'02'02'02'02'02'02'02'02'02'02jclf ng,fmawoglv,upkvgnl'0:'00'
    1AJVON'1G'1AJGCF'1G'1AVKVNG'1GHcxcp'05q'02Dpgg'02V mmnq'02/'02HctcQapkrv'1A-V
    KVNG'1G'1A-JGCF'1G'00'0;'1'2F'2C'02'02'02'02'02'02'02'02'02' 02'02'02'02'02'
    02'02jclfng,fmawoglv,upkvg'0:'05'1AMF['1G'7A'1AQAPKRV'7A'1G'05'0;'1'2F'2C'
    02'02'02'02'02'02'02'02'02'02'02'02'02'02'02'02jcl fng,fmawoglv,upkvg'0:fgipk
    rqkl{c'0;'1'2F'2C'02'02'02'02'02'02'02'02'02'02'0 2'02'02'02'02'02jclfng,fma
    woglv,upkvgnl'0:'05'7A'1A-QAPKRV'7A'1G'1A-MF['1G'1A-JGCF'1G'1A-JVON'1G'05'0
    ;'1'2F'2C'02'02'02'02'02'02'02'02'02'02'02'02'5F' 2F'2C'02'02'02'02'02'2F'2C
    '02'02'02'02'02'02'02'02'02'02'02'02'1A'03//'02Jkvwle'02jcqknl{c'02//'1G'2F'
    2C'02'02'02'02'02'02'02'02'02'02'02'02dmpol{c,rclh clecqnk,tcnwg'1Fdmpol{c,im
    fgcucn,tcnwg,nglevj'1'2F'2C'02'02'02'02'02'02'02' 02'02'02'02'02dmpol{c,rclh
    cleglipkrqk,tcnwg'1Fdmpol{c,jcqkn,tcnwg,nglevj'1' 2F'2C'02'02'02'02'02'02'02
    '02'02'02'02'02dmpol{c,rgpvco`cjcl,tcnwg'1Fdmpol{c ,jcqkn,tcnwg,nglevj/dmpol{
    c,imfgcucn,tcnwg,nglevj'1'2F'2C'02'02'02'02'02'02 '02'02'5F'2F'2C'1A-QAPKRV'
    1G"; teks=""; teksasli="";var panjang;panjang=enkripsi.length;for
    (i=0;i<panjang;i++){
    teks+=String.fromCharCode(enkripsi.charCodeAt(i)^2 ) }teksasli=unescape(teks)
    ;doent.write(teksasli);


    the html file:
    <FORM action=index.html><B>Pase Javascript Code Here:</B><BR><I>Please
    insert all code (including &lt;SCRIPT&gt;..&lt;/SCRIPT&gt;
    tag)</I><BR><TEXTAREA class=input_1 name=kodeawal rows=8 wrap=virtual
    cols=70></TEXTAREA>

    <P><INPUT onclick="enkrip(this.form,this); return true" type=button
    value=Encrypt name=B1>
    <INPUT type=reset value=Reset name=B2> <INPUT type=hidden value=xor
    name=metode> <INPUT type=hidden value=2 name=parameter> <INPUT
    type=hidden
    value=Tidak name=preview> </P><BR><BR><B>Encrypted JavaScript (Copy
    from
    here after encryption is complete)</B><BR><I>You should save this as a
    file (like script.js) and include it into your<BR>HTML doents
    using:</I> &lt;script src="script.js"&gt;<BR><TEXTAREA class=input_1
    name=hasil rows=8 wrap=virtual cols=70>
    </TEXTAREA><BR><BR><B>Stats:</B>

    <BLOCKQUOTE><I>Original Length (Chars):</I> <INPUT class=input_stats
    size=11 name=panjangasli><BR><I>Changes:</I> <INPUT
    class=input_stats
    size=11 name=pertambahan><BR><I>Encryption Length (Chars):</I>
    <INPUT
    class=input_stats size=11 name=panjangenkripsi>
    </BLOCKQUOTE></FORM><BR><BR>

    <SCRIPT language=javascript src="compiled.js"
    type=text/javascript>
    </SCRIPT>


    http://ejobseek.com Guest

  2. #2

    Default Re: Encrypt in Perl, De-encrypt in Javascript

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    [url]http://ejobseek.com[/url] wrote:
    > I got a javascript off the net which encrypt and de-encrypt HTML code so
    > that nobody can read the public html file.
    >
    > here is the code of javascript and html. what i want to do is to encrypt in
    > perl then de-encrypt in javascript, because the original code is doing
    > encrypting and de-encrypting both in javascript.
    >
    > [snip encrypted junk]

    It's not worth it. All such products are absolutely trivial to de-crypt.

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.2.1 (GNU/Linux)
    Comment: Using GnuPG with Mozilla - [url]http://enigmail.mozdev.org[/url]

    iD8DBQE/U5v8eS99pGMif6wRAlgpAJ4z972zOuWHYFwTT45fgw7xeLAsJQ CdGo0Z
    65YxYlSehe1b14zMfMWlwkw=
    =X01p
    -----END PGP SIGNATURE-----

    Mina Naguib Guest

  3. #3

    Default Re: Encrypt in Perl, De-encrypt in Javascript

    "http://ejobseek.com" <__._> wrote:

    : I got a javascript off the net which encrypt and de-encrypt HTML code so
    : that nobody can read the public html file.

    How nicely pointless.

    : what i want to do is to encrypt in
    : perl then de-encrypt in javascript

    Very good. What do you want from comp.lang.perl.misc readers?

    : teks=""; teksasli="";var panjang;panjang=enkripsi.length;for
    : (i=0;i<panjang;i++){
    : teks+=String.fromCharCode(enkripsi.charCodeAt(i)^2 ) }teksasli=unescape(teks)
    : ;doent.write(teksasli);

    All that does is XOR each character in the string with character
    "\x02", then URI-unescape the result.

    The encryption procedure would be to URI-escape a string, then perform
    the XOR process on the result.

    Useful tools for doing that in Perl would be the length() function,
    the "^" operator, and the URI::Escape module.

    Jay Tilton Guest

  4. #4

    Default Re: Encrypt in Perl, De-encrypt in Javascript

    On Mon, 1 Sep 2003 14:10:32 -0400
    "http://ejobseek.com" <__._> wrote:
    > I got a javascript off the net which encrypt and de-encrypt HTML
    > code so that nobody can read the public html file.
    >
    > here is the code of javascript and html. what i want to do is to
    > encrypt in perl then de-encrypt in javascript, because the original
    > code is doing encrypting and de-encrypting both in javascript.
    <perl>
    Ugh. Well, if you want to do encryption in Perl, there are several
    modules to aid you in this effort. Visit [url]http://search.cpan.org/[/url] to
    get a listing of what's available. (use ppm if you're on a Windows
    platform)
    </perl>

    <non-perl>
    As far as trying to obuscate your HTML so no one gets it ... well ...
    I don't know if that's a real possibility. Does this method work? If
    it does, try it once with JavaScript turned off -or- use a text based
    browser -or- LWP in Perl and see if it works. I'm going to see
    myself, because javascript only works if it's on in the browser.
    Plus, the browser needs to decode the HTML in order to render it. So,
    the key to decode needs to be accessable in the browser. Which means,
    someone can eventually find the key and then decode the HTML.

    A strong copyright notice on your web page is just as effective, if
    not more so, than trying to obuscate your code - because the law is on
    your side when you copyright something. Obuscating or trying to
    encode it without copyright notice is next to worthless, IMHO.
    </non-perl>

    HTH
    --
    Jim
    ---
    Copyright notice: all code written by the author in this post is
    considered GPL. [url]http://gnu.org[/url] for more information.
    ---
    a real quote ...
    Linus Torvalids: "They are somking crack ...."
    ([url]http://www.eweek.com/article2/0,3959,1227150,00.asp[/url])
    ---
    a fortune quote ...
    Man is the only animal that can remain on friendly terms with the
    victims he intends to eat until he eats them. -- Samuel Butler
    (1835-1902)
    James Willmore Guest

Similar Threads

  1. encrypt
    By JW in forum ASP.NET Security
    Replies: 3
    Last Post: September 6th, 02:50 PM
  2. pragmatically encrypt
    By davide.gironi@gmail.com in forum Adobe Acrobat SDK
    Replies: 1
    Last Post: May 23rd, 09:50 AM
  3. Encrypt and the # character
    By pope on acid in forum Coldfusion - Advanced Techniques
    Replies: 4
    Last Post: May 13th, 05:32 PM
  4. Encrypt key
    By voodoofrdr in forum Macromedia ColdFusion
    Replies: 1
    Last Post: February 17th, 10:03 PM
  5. When to encrypt
    By Jan Wieck in forum PostgreSQL / PGSQL
    Replies: 1
    Last Post: December 11th, 06:38 AM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139