$u=shift; # $u = string to encrypt for ($i = 0; $i < length($u); $i++) { # Change all the alphabetical $c .= ord(substr($u,$i,1)); # characters to their ascii } # equivilent numbers. $c="$c$c"; # Double the length of the string for ($i = 0; $i < length($c); $i++) { # Go through and increment substr($c,$i,1)++; # every other number in $i++; # the string. } for ($i = 0; $i < length($c); $i++) { # Go through and add (number) + (previous number) substr($c,$i,1) = substr($c,$i-1,1) + substr($c,$i/2,1); } for ($i = 0; $i < length($c); $i++) { # Increment through the string and for ($j = 0; $j < length($c); $j++) { # replace numbers 32 - 128 with their if ((substr($c,$i,$j) < 128) && (substr($c,$i,$j) > 32)) { # numeric ascii counterparts. substr($c,$i,1) = chr(substr($c,$i,$j)); } } } print "$c\n"; # $c = encrypted string