If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Enjoy an ad free experience by logging in. Not a member yet? Register.

Mini encryption engines.

and saw what a kludged together thing people were using to encrypt their URLs. So I wrote not one, but two, encryption engines that would do a sound job of encoding them. They can even be used to handle quite large files with a reasonable security.

function enCrypt($input_string) {//print_r(hash_algos()); // Uncomment to get available hashes.$keys=hash("md5",$input_string);$key_char=str_split($keys,1);$input_char=str_split($input_string,1);$k=count($key_char);$c=count($input_char); for($i=0;$i<$c;$i++) {$num=ord($input_char[$i])+ord($key_char[($i)%$k])+(rand(1,15)*4096);$stk[$i]=dechex($num); }$input_string=implode($stk);$input_string=$keys.$input_string; // Hash of input string used as key.file_put_contents("./test.txt",$input_string); // For testing. //return $input_string;deCrypt($input_string); // Uncomment this line for testing.}