VincentCheung.ca Blog

JavaScript Encryption and Decryption 2.0

The new version of JavaScript Encryption and Decryption is out!

Try it:
Show encrypted text  (the decryption key is: password)

The new encryption code is a lot faster than the old version and the webpage decryption code now uses a fancy dialog box to ask you for the key. The entire process has been greatly simplified and the encryption page will automatically generate code that you can copy and paste into your website.

Note: the new version is not backwards compatible with the old version

JavaScript Encryption and Decryption 2.0 Release Notes:
Nov. 27, 2008

  • Faster
  • Automatically generates HTML code for your website
  • Fancy dialog box to ask you for the key
  • Simpler to use and more examples
  • Fixed bugs with Internet Explorer

21 Responses to “JavaScript Encryption and Decryption 2.0”

  1. W Ng Says:

    Hi Vincent,

    Excellent work with the encryption/decryption code.

    My question is – can I read the key from the web.config file instead of the default pop up dialog? If so, please demonstrate how.

    Many thanks.

  2. Vincent Cheung Says:

    As the code stands, you must enter the key either using the pop-up dialog or the JavaScript dialog prompt.

  3. WKS Says:

    Is there anyway to hide/disable the tooltip/popup message box that currently displays the encrypted text string from the DIV section without forcing the viewer to disable in their browser? I’ve been fiddling around with it but seem to be getting nowhere with it.

    I’ve managed to stop it from displaying when the mouse is over the actual link by overriding the TITLE from the DIV with another blank entry at the HREF (i.e. link). However, the tooltip still appears when the mouse becomes the caret when near the link text. I’m thinking a onMouseOver event but dunno what to call after that.

    Thnks and rgrds

  4. Vincent Cheung Says:

    As of now, there is no way to stop the popup. It is browser dependent. I’ll look into ways that I can fix this.

  5. Kong Says:

    I’ve tried using this code on my blog but the the popup box prompting for the password cannot be visible. Please help!

  6. Raddie Says:

    Hi Vincent,

    big thanks for ur work. I translated the instruction into Indonesian, and am doing the german-translation right now. it should be up by this time tomorrow..

    here’s the indonesian-translation: http://raddie.blogspot.com/2009/04/encrypted-aka-password-protected-post.html

  7. Raddie Says:

    And the german translation is up!

    http://raddie.blogspot.com/2009/04/verschlusselter-aba-passwortgeschutzter.html

  8. Bill Querry Says:

    I would like to use yiour code to stuff encrypted data into a database as it is created and then pull it out to display from the database when needed. Is the source code available to encrypt and decrypt to include on my website?

  9. Vincent Cheung Says:

    Just take a look at the JavaScript files or use OpenSSL.

  10. Britney Says:

    The password box won’t pop up when I try it either. I’m just a beginner with html code, but I think I’m following the instructions carefully. Does it not work with all blogger layouts?

  11. Britney Says:

    Nevermind I figured it out. This is great! Thank you.

  12. michelle Says:

    hi Vincent:

    Thanks for your work
    everything was doing great before.
    but these days, i tried using this code on my blog but the the popup box prompting for the password doesnt appear!
    could you help me!
    Thank you!

  13. BioGal Says:

    This is COMPLETELY brilliant! I am SO impressed! I tried a while back to use this service but I was foxed by the HTML, but NOW I have been a bit braver and it works!

    I’d actually like to format the text so that it doesn’t just run in a long line when revealed. I am trying to put my CV/resume online so it does need to look professional.

    If formatting is too tricky, a pdf, or an image of a pdf (like the icon image you’ve used) would work. But I don’t know where to host the image. Shall I just import it to blogger as usual?

    Thanks for all your hard work.

  14. Vincent Cheung Says:

    When you encode the text, don’t just encode the plain text, encode the html code and then it should do what you want.

  15. Christoph Says:

    Quote:
    WKS Says:
    March 27th, 2009 at 1:07 pm

    Is there anyway to hide/disable the tooltip/popup message box that currently displays the encrypted text string from the DIV section without forcing the viewer to disable in their browser? I’ve been fiddling around with it but seem to be getting nowhere with it.

    Did you find any solution for this? The code is incredible great and I could use it on our homepage of our independent company in Mexico, but the popup is a little annoying…
    take a look: http://cotorrafilms-inhouse.blogspot.com/

    Thanks for your response and your hard work.

  16. Paolo Cavellini Says:

    I have problems using your code in Chrome browser.
    Your code:

    if(!Array.indexOf){Array.prototype.indexOf=function(a,b){for(var i=(b||0);i<this.length;i++){if(this[i]==a){return i}}}}

    In Chrome Array.indexOf is undefined and defining Array.prototype.indexOf doesn't seem a good idea.
    I found in a discussion an alternative test working for Chrome and I changed your code in this way

    if(!Array.indexOf && ![].indexOf){Array.prototype.indexOf=function(a,b){for(var i=(b||0);i<this.length;i++){if(this[i]==a){return i}}}}

    Paolo

  17. Skizz Jones Says:

    Apart from the annoying tooltip popup from the the title attribute it’s a very nice script. Tried tinkering with the script thinking the alt tag could be used instead but have not quite cracked it.

    Posibble workaround would be to swap the value of title tag into a cookie or client side storage, replacing it with null. Then swap it back in onmouseover somewhere.

    crypto=document.getElementById(“??????”).title
    document.getElementById(“??????”).title=”"

  18. Florin Catalin Says:

    Hi Vincent,
    Excellent work with the encryption/decryption code!
    But I have a question: how can I use decryptText function to show hidden text not on page, but inside one alert box ? For example, I want to use tree variables, one for uniqueID, the second for encrypted text and third to give me the decrypted text who can be used in alert box. It is possible ?
    Thank you very much,
    Florin Catalin

  19. How to Barbeque Says:

    How to Barbeque…

    [...]VincentCheung.ca Blog » Blog Archive » JavaScript Encryption and Decryption 2.0[...]…

  20. lustra lazienkowe Says:

    lustra lazienkowe…

    [...]VincentCheung.ca Blog » Blog Archive » JavaScript Encryption and Decryption 2.0[...]…

  21. Percy Says:

    The password box won’t pop up when I try it. I think I’m following the instructions carefully. Does it not work with all blogger layouts?

Leave a Reply