Use PHP for simple character encryption. There is nothing to do. I want to try encryption, so I used my familiar PHP to write it... principle: convert a character into an ASCII code, convert the ASCII code, convert the result into a character, and complete encryption. try encryption, so I used my familiar PHP to write...
Principle:
Convert characters into ASCII codes, convert the ASCII codes, convert the results into characters, and complete encryption.
?
Implementation:
Enter the characters to encrypt:
Error_reporting (255 );
If (isset ($ val ))
{
? // Encrypt
?? For ($ I = 0; $ I
? {
?? $ C = $ value [$ I];
?? $ C = ord ($ c );
?? If ($ c> 31 & $ c <107)
?? {
??? $ C = $ c + 20;
??? Print ("character before encryption:". $ val );
??? Print ("
Encrypted characters: ". chr ($ c ));
??? Print ("
");
??}?
?? Elseif ($ c> 106 & $ c <127)
?? {
??? $ C = $ C-75;
??? Print ("character before encryption:". $ val );
??? Print ("
Encrypted characters: ". chr ($ c ));
??? Print ("
");??
??}
?}
}
Else
{
? Print ("Enter the characters you want to encrypt ");
}
?>
During the conversion process of asc, pay attention to some problems. for example, if asc is from 0 to 127, then asc Greater than 127 or less than 0 cannot appear during conversion, this should be well controlled. it is best to make a table by yourself.
........................................ ............................
Principle: convert the character into ASCII code, convert the ASCII code, convert the result into a character, and complete encryption...