PHP Custom Encryption and decryption program
PHP3 Cryption is a very easy to hack, insecure encryption feature and should not be very important for things to use. While encryption is good, it does not hinder the rigorous testing of cutting-edge cracking procedures.
However, try it ... This is a great way to encrypt and decrypt strings. With many recess functions, this is bidirectional. Based on a password, you can encrypt or decrypt it. You can also decrypt or encrypt countless times, through loops or other methods. The characters in the alphabet also change. All of these things allow you to modify and consolidate encryption.
What's the best part about this? You can encrypt and decrypt or a piece of paper and a pencil. This takes quite a bit longer, but you don't need a computer that is nearby to use it if you ever lose the code if you remember that your technology can decrypt it.
I wrote these features in about an hour, after several unsuccessful and frustrating attempts, and gained a longer time I had no way out. The best way to succeed the day after doing it suddenly comes true.
Note that this does not encrypt/decrypt invisible characters (spaces), such as line break (n) or label (TON)! I'm sorry, but I tried. If you find a way, please let me know!
* /
Highlight_file ("crypto.php tutorial");
$ralphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890!,.:;? ~@#$%^&* () _+-=][}{/>< "'";
$alphabet = $ralphabet. $ralphabet;
Class Crypto {
function Encrypt ($password, $strtoencrypt) {
Global $ralphabet;
Global $alphabet;
for ($i =0; $i
{
$cur _ps Tutorial wd_ltr = substr ($password, $i, 1);
$pos _alpha_ary[] = substr (Strstr ($alphabet, $cur _pswd_ltr), 0,strlen ($ralphabet));
}
$i = 0;
$n = 0;
$nn = strlen ($password);
$c = strlen ($strtoencrypt);
while ($i < $c)
{
$encrypted _string. = substr ($pos _alpha_ary[$n],strpos ($ralphabet, substr ($strtoencrypt, $i, 1)), 1);
$n + +;
if ($n = = $nn) $n = 0;
$i + +;
}
return $encrypted _string;
}
function Decrypt ($password, $strtodecrypt) {
Global $ralphabet;
Global $alphabet;
for ($i =0; $i
{
$cur _pswd_ltr = substr ($password, $i, 1);
$pos _alpha_ary[] = substr (Strstr ($alphabet, $cur _pswd_ltr), 0,strlen ($ralphabet));
}
$i = 0;
$n = 0;
$nn = strlen ($password);
$c = strlen ($strtodecrypt);
while ($i < $c)
{
$decrypted _string. = substr ($ralphabet, Strpos ($pos _alpha_ary[$n],substr ($strtodecrypt, $i, 1)), 1);
$n + +;
if ($n = = $nn) $n = 0;
$i + +;
}
return $decrypted _string;
}
function Cryption_table ($password) {
Global $ralphabet;
Global $alphabet;
for ($i =0; $i
{
$cur _pswd_ltr = substr ($password, $i, 1);
$pos _alpha_ary[] = substr (Strstr ($alphabet, $cur _pswd_ltr), 0,strlen ($ralphabet));
}
Print "
Print "
for ($i =0; $i
{
Print "
Print "
n ";
| "; for ($j =0; $j {print "
" . substr ($ralphabet, $j, 1). " | n "; } print "
";
" . ($i + 1). "| | "; for ($k =0; $k {print "
" . substr ($pos _alpha_ary[$i], $k, 1). " | n "; } print "
"; }
n ";
}
}//End Class Crypto
Example written by Macro Zeng
Network Technology leader motto: Three people will have my teacher Yan. Http://www.bkjia.com
$CT = new Crypto;
$ct->cryption_table ($password);
echo "";
http://www.bkjia.com/PHPjc/444928.html www.bkjia.com true http://www.bkjia.com/PHPjc/444928.html techarticle PHP Custom Encryption and decryption program PHP3 Cryption is a very easy to hack, insecure encryption feature and should not be very important for things to use. Although encryption is good, it does not hinder the ...