Here are two very crazy encrypt and decrtpt functions i made just change around some of the arrays to make it more secure but don't share what u use =]
lol edited nevermind the title its one function
lol edited nevermind the title its one function
PHP Code:
<?php
function encrypt_decrypt($str,$encrypt_or_decrypt) {
$txt = array("1"=>"a","2"=>"b","3"=>"c","4"=>"d","5"=>"e","6"=>"f","7"=>"g","8"=>"h","9"=>"i","10"=>"j","11"=>"k","12"=>"l","13"=>"m","14"=>"n","15"=>"o","16"=>"p","17"=>"q","18"=>"r","19"=>"s","20"=>"t","21"=>"u","22"=>"v","23"=>"w","24"=>"x","25"=>"y","26"=>"z",);
$txt2 = array("1"=>"!","2"=>"~","3"=>"#","4"=>"$","5"=>"%","6"=>"^","7"=>"&","8"=>"*","9"=>"[","10"=>"]","11"=>"{","12"=>"}","13"=>":","14"=>"|","15"=>"/","16"=>"?","17"=>"<","18"=>">","19"=>".","20"=>"'","21"=>"_","22"=>"-","23"=>"+","24"=>"=","25"=>"0","26"=>"1",);
if($encrypt_or_decrypt=="" || $encrypt_or_decrypt=="decrypt") { $encrypt_or_decrypt = "decrypt"; } else { $encrypt_or_decrypt = "encrypt"; }
if($encrypt_or_decrypt=="decrypt") { $decrypted = str_replace($txt2,$txt,$str); } if($encrypt_or_decrypt=="encrypt") { $encrypted = str_replace($txt,$txt2,$str); }
if($encrypt_or_decrypt=="decrypt") { echo $decrypted; } if($encrypt_or_decrypt=="encrypt") { echo $encrypted; }
}
/// <- lets test the function now -> ///
echo "encrypted<br />";
echo encrypt_decrypt("test","encrypt"); /// <- to encrypt test to '%.'
echo "<br />";
echo "decrypted<br />";
echo encrypt_decrypt("'%.'","decrypt"); /// <- to decrypt '%.' to test
//it works :)//
?>
Comment