Simple character encryption with PHP

xiaoxiao2021-03-06  77

I don't do, I want to try encryption, so I use my familiar PHP to write ...

principle:

Convert characters to the ASCII code, then convert the ASCII code, turn the result to the character, and complete it.

?

achieve:

Enter the characters you want to encrypted:

Error_Reporting (255); if (isset ($ VAL)) {? // Encryption ?? for ($ I = 0; $ I

? {

? $ c = $ value [$ I];

? $ c = ORD ($ C);

?? IF ($ C> 31 && $ C <107)

?? {

??? $ c = $ c 20;

??? Print ("The characters before encryption:". $ VAL);

???print ("

Encrypted characters: ". Chr ($ c));

???print ("

");

??}?

?? Elseif ($ C> 106 && $ C <127)

?? {

??? $ c = $ c-75;

??? Print ("The characters before encryption:". $ VAL);

???print ("

Encrypted characters: ". Chr ($ c));

???print ("

");??

??}

?

}

Else

{

? Print ("Please enter the character you want to encrypted");

}

?>

Pay attention to some problems during the conversion of ASC, such as ASC from 0-127, then when transforming, the ASC greater than 127 or less, this is controlled, it is best to grade its own list .

Since the encryption algorithm has come out, then the decryption is almost the same, huh, I will not write .....

转载请注明原文地址:https://www.9cbs.com/read-121699.html

New Post(0)