in function need key to encrypt string without mcrypt libraly in php
function encrypt($str, $pass){
$str_arr = str_split($str);
$pass_arr = str_split($pass);
$add = 0;
$div = strlen($str) / strlen($pass);
while ($add <= $div) {
$newpass .= $pass;
$add++;
}
$pass_arr = str_split($newpass);
foreach($str_arr as $key =>$asc) {
$pass_int = ord($pass_arr[$key]);
$str_int = ord($asc);
$int_add = $str_int + $pass_int;
$ascii .= chr($int_add);
}
return $ascii;
}
function decrypt($enc, $pass){
$enc_arr = str_split($enc);
$pass_arr = str_split($pass);
$add = 0;
$div = strlen($enc) / strlen($pass);
while ($add <= $div) {
$newpass .= $pass;
$add++;
}
$pass_arr = str_split($newpass);
foreach($enc_arr as $key =>$asc) {
$pass_int = ord($pass_arr[$key]);
$enc_int = ord($asc);
$str_int = $enc_int - $pass_int;
$ascii .= chr($str_int);
}
return $ascii;
}
in this not work for i character i test it