Search code examples
javascriptjqueryencodedecode

How to simply encode and decode a string variable


I need to simply encode a string variable (my api key) so that is not easily readable by human eyes, I need it to easily decode back to exactly the same initial string. What is the standard practical and fast (less computing on the user side) way to do this?

Many thanks in advance!


Solution

  • If it doesn't have to be super-secure, Base64 encoding is always handy:

    http://www.webtoolkit.info/javascript-base64.html