Last active
September 10, 2016 23:02
-
-
Save navopw/afc4bf8bf43a9f2bfdd8b036f6a31977 to your computer and use it in GitHub Desktop.
Javascript Base64 encode & decode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function BASE64_encode(str) { | |
return window.btoa(unescape(encodeURIComponent(str))); | |
} | |
function BASE64_decode(str) { | |
return decodeURIComponent(escape(window.atob(str.replace(/\s/g, '')))); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment