Skip to content

Instantly share code, notes, and snippets.

@danbrianwhite
Created January 10, 2017 13:28
Show Gist options
  • Save danbrianwhite/15d011f048fccc5b36f139082142d00f to your computer and use it in GitHub Desktop.
Save danbrianwhite/15d011f048fccc5b36f139082142d00f to your computer and use it in GitHub Desktop.
string obfuscate + deobfuscate
String.prototype.obfuscate = function()
{
var temp = '';
for(i = 0; i < this.length; i++){temp += String.fromCharCode(this.charCodeAt(i)+parseInt((i+1)%5))};
return temp;
}
String.prototype.deobfuscate = function()
{
var temp = '';
for(i = 0; i < this.length; i++){temp += String.fromCharCode(this.charCodeAt(i)-parseInt((i+1)%5))};
return temp;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment