Have nothing to do, want to try encryption, and then use their familiar php to write ...
Principle:
Convert the characters to ASCII, then convert the ASCII code, convert the result into a character, and the encryption is done.
?
Realize:
Enter the characters you want to encrypt:
Error_reporting (255);
if (Isset ($val))
{
?//For encryption
?? for ($i =0; $i
? {
?? $c = $value [$i];
?? $c = Ord ($c);
?? if ($c >31 && $c <107)
?? {
??? $c = $c +20;
??? Print ("Pre-encrypted character:".) $val);
??? Print ("
Encrypted character: ". Chr ($c));
??? Print ("
");
??}?
?? ElseIf ($c >106 && $c <127)
?? {
??? $c = $c-75;
??? Print ("Pre-encrypted character:".) $val);
??? Print ("
Encrypted character: ". Chr ($c));
??? Print ("
");??
??}
?}
}
Else
{
? print ("Please enter the character you want to encrypt");
}
?>
The process of conversion to ASC should pay attention to some problems, such as ASC is from 0-127, then the conversion can not appear greater than 127 or less than 0 ASC, this should be controlled, the best results of their own list to see.
....................................................................