Advanced Search

Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Encryption

  1. #1
    Join Date
    Nov 2005
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Encryption

    Hey,

    Is there any type of encryption that is both in javascript and in php?

    What i want to do is be able to encrypt something with a php script and decrypt it in javascript so that it is not readable to the human eye.


    Thanks in advance

  2. #2
    Join Date
    Aug 2005
    Posts
    971
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Talking about something like..

    Are you talking about something like this: http://scriptasylum.com/tutorials/en...de-decode.html
    ??

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    No, s/he isn't. I think s/he is talking about actual encryption.
    kkroo: Unfortunately, this is not possible. The reason for this is that your Javascript is visible to anyone, and you must include the decryption algorithm and any necessary keys in that Javascript. Ergo, it is impossible to do this securely.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    Aug 2005
    Posts
    971
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    OOPS!! Sorry for the misunderstanding.
    Yea that seems to be a disadvantage of making rich internet APIs in a client side scripting language.

  5. #5
    Join Date
    Nov 2005
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    The method shachi has is alright, you cant read the source code with it. But what php function would be able to do that?

  6. #6
    Join Date
    Aug 2005
    Posts
    971
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    the PHP(simple one)

    echo '<script type="text/javascript">document.write(unescape(encoded code));</script>

  7. #7
    Join Date
    Nov 2005
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I mean doing it without javascript, like an actual php function

  8. #8
    Join Date
    Aug 2005
    Posts
    971
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up

    Umm.. sorry to disappoint you but I don't think that it is possible or may be my knowledge is not enough as I am not that good at PHP. Try asking the guyz on IRC freenode. I bet they would help you out of this problem. But that's just an advice.

    Good luck!!!

  9. #9
    Join Date
    Aug 2005
    Posts
    971
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    or may be Twey knows something about it?? Try messaging him or wait till he looks at this message again.

  10. #10
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Code:
    <?php
    function urlfuscate($str) {
      $op = "";
      for($i=0;$i<strlen($str);$i++)
        $op .= "%" . bin2hex(substr($str, $i, 1));
      return $op;
    }
    ?>
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

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
  •