This is not about security. It is also not to make it hard to break. I\'m looking for a simple algorithm to change a string (a url) in a way it does not resemble the origina
If it's not about security, and not about making it hard to break, then how about ROT-13
?
//+ Jonas Raoni Soares Silva
//@ http://jsfromhell.com/string/rot13 [rev. #1]
String.prototype.rot13 = function(){
return this.replace(/[a-zA-Z]/g, function(c){
return String.fromCharCode((c <= "Z" ? 90 : 122) >= (c = c.charCodeAt(0) + 13) ? c : c - 26);
});
};
...
var s = "My String";
var enc = s.rot13(); // encrypted value in enc
PHP has a native function, str_rot13
: http://php.net/manual/en/function.str-rot13.php
$decrypted = str_rot13($_GET['whatever']);