#native_company# #native_desc#
#native_cta#

Simple Encryption based on Multidimensional ARRAy

By saurabh
on January 11, 2001

Version: 1.0

Type: Sample Code (HOWTO)

Category: Algorithms

License: GNU General Public License

Description: This is a code which will encrypt any text. you can make your own encryption call. You have to add encryption value in the multidimensional array at the begning of the code

<?
$password = amresh;
$username = "[email protected]";
$encinfo = array( "$username" , "$password");
//function secrand() {
$alpha = array ("0" => array ("a" , "b" , "c" , "d" , "e" , "f" , "g" , "h" , "i" , "j" , "k" ,
               "l" , "m" , "n" , "o" , "p" , "q" , "r" , "s" , "t" , "u" , "v" ,
               "w" , "x" , "y" , "z"),
               "1" => array ("i" , "o" , "t" , "q"  ,"a" , "w" , "d" , "z" , "h" , "r" ,
               "p" , "b" , "u" , "y" , "s" , "e" , "g" , "c" , "k" , "m" , "x" , "f" ,
               "n" , "l" , "j" , "v"));


$alphau = array( "0" => array ("A" , "B" , "C" , "D" , "E" , "F" , "G" , "H" , "I" , "J" , "K" ,
               "L" , "M" , "N" , "O" , "P" , "Q" , "R" , "S" , "T" , "U" , "V" ,
               "W" , "X" , "Y" , "Z"),
               "1" => array ("i" , "o" , "t" , "q"  ,"a" , "w" , "d" , "z" , "h" , "r" ,
               "p" , "b" , "u" , "y" , "s" , "e" , "g" , "c" , "k" , "m" , "x" , "f" ,
               "n" , "l" , "j" , "v"));

$beta = array("0" , "1" , "2" , "3" , "4" , "5" , "6" , "7" , "8" , "9");

for($z = 0; $z < 2; ++$z) {
$len = strlen($encinfo[$z]);
$nlen = $len;
$j = 0;
for ($i = 0; $i < $len; ++$i)  {
$passarr[$z][$j] = substr($encinfo[$z], -$nlen ,1);
++$j;
--$nlen;
}
}
function pr ($s) {
echo ($s . "");
}
echo("<br>n");
array_walk($passarr[0], pr);
echo("<br>n");
array_walk($passarr[1], pr);


for($d = 0; $d < 2; ++$d) {
$arr = count($passarr[$d]);
for($b = 0; $b < $arr; ++$b) {
for($a = 0; $a < 26; ++$a)  {
if($passarr[$d][$b] == $alpha[0][$a]) {
  $newp[$d][$b] = $alpha[1][$a];
 }
 elseif($passarr[$d][$b] == $alphau[0][$a]) {
   $newp[$d][$b] = $alphau[1][$a];
  }


 }
 if($newp[$d][$b] == "") {
 $newp[$d][$b] = $passarr[$d][$b];
 }
  }
  }

function pr1 ($s) {
echo ($s . "");
}
echo("<br>n");
array_walk($newp[0], pr1);
echo("<br>n");
array_walk($newp[1], pr1);



?>