I have a question about the following code...I am trying to encrypt a string and code it with a key word, it should work like this:
1 turn the spaces on frase you want to encrypt to "+" sings and divide into string into the size of the keyword.
2 turn the string into numbers, example a=01, b=02...also do this for keyword
3 to the number string we add the module 27 from number keyword string like this:
0119001109
0512091520
0604092602
4 turn the encrypted number string back to a character string.
I so far have the following code, I ran into problems when dividing the number string and add module27 outside the loop, I'll appreciate any suggestions you could give me, Any Ideas??????????
<?php
$letras=array('00'=>'+','01'=>'a','02'=>'b','03'=>'c','04'=>'d','05'=>'e','06'=>'f','07'=>'g','08'=>'h','09'=>'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');
$frase = 'as kingfishers catch fire';
$clave= "eliot";
$frase1=str_replace(" ","+",$frase);
$div=strlen($clave);
$strin=chunk_split($frase1,$div);
$div1=strlen($strin);
echo $strin,"<br>";
for($i=0;$i<=$div1;$i++){
$a=$strin {$i};
$b=$clave {$i};
$key=array_search($a,$letras);
$key1=array_search($b,$letras);
echo $key;
echo $key1;
}
?>