Last active
December 7, 2020 18:35
-
-
Save nainemom/09720dc0c90cc6777d220d376124b9a8 to your computer and use it in GitHub Desktop.
Very simple Javascript string encode and decoder
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 encoder(str, numericPass = 1234, decode = false) { | |
return str.split('').map(c => String.fromCharCode((c.charCodeAt(0) + ((decode ? -1 : 1) * numericPass)) % 256)).join('') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment