国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > PHP > 正文

php自定加密與解密程序

2024-05-04 21:49:00
字體:
來源:轉載
供稿:網友

PHP3 Cryption是一個非常容易被破解,不安全的加密功能,不應該是非常重要的東西用,雖然加密是好的,它不會阻礙對尖端開裂程序的嚴格考驗.

不過,試試吧...這是一個偉大的方式來加密和解密字符串。與許多隱窩功能,這是雙向的。基于一個密碼,您可以加密或解密。您也可以解密或加密過無數次,通過循環或其他方法。字母表中的字符也是變化的。所有這些事情讓你修改和鞏固加密。

關于這最佳的部分?您可以加密與解密或一張紙和一支鉛筆一塊。這需要相當長一點,但你并不需要一臺電腦是附近使用它,如果你曾經失去的代碼,如果你還記得你的技術可以解密。

我寫在約一小時這些功能,經過幾次不成功的和令人沮喪的嘗試,并獲得了更長的時間我沒有出路的。成功的那天后的最佳方式做它突然實現。

請注意,這不會加密/解密無形字符(空格),如換行符(n)或標簽(噸)!很抱歉,但我嘗試,如果你找到一個辦法,請讓我知道!

  1. * / 
  2. highlight_file(“crypto.php”); 
  3.  
  4. $ralphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890 !,.:;?~@#$%^&*()_+-=][}{/><"'";  
  5. $alphabet = $ralphabet . $ralphabet
  6.  
  7.  
  8. class Crypto { 
  9.  
  10. function encrypt ($password,$strtoencrypt) { 
  11.  
  12. global $ralphabet;  
  13. global $alphabet
  14.  
  15. for$i=0; $i<strlen($password); $i++ )  
  16. {  
  17. $cur_pswd_ltr = substr($password,$i,1);  
  18. $pos_alpha_ary[] = substr(strstr($alphabet,$cur_pswd_ltr),0,strlen($ralphabet));  
  19.  
  20. $i=0;  
  21. $n = 0;  
  22. $nn = strlen($password);  
  23. $c = strlen($strtoencrypt); 
  24.  
  25. while($i<$c)  
  26. {  
  27. $encrypted_string .= substr($pos_alpha_ary[$n],strpos($ralphabet,substr($strtoencrypt,$i,1)),1); 
  28.  
  29. $n++;  
  30. if($n==$nn$n = 0;  
  31. $i++;  
  32.  
  33. return $encrypted_string
  34.  
  35.  
  36.  
  37.  
  38.  
  39. function decrypt ($password,$strtodecrypt) { 
  40.  
  41. global $ralphabet;  
  42. global $alphabet
  43.  
  44. for$i=0; $i<strlen($password); $i++ )  
  45. {  
  46. $cur_pswd_ltr = substr($password,$i,1);  
  47. $pos_alpha_ary[] = substr(strstr($alphabet,$cur_pswd_ltr),0,strlen($ralphabet));  
  48.  
  49. $i=0;  
  50. $n = 0;  
  51. $nn = strlen($password);  
  52. $c = strlen($strtodecrypt); 
  53.  
  54. while($i<$c)  
  55. {  
  56. $decrypted_string .= substr($ralphabet,strpos($pos_alpha_ary[$n],substr($strtodecrypt,$i,1)),1); 
  57.  
  58. $n++;  
  59. if($n==$nn$n = 0;  
  60. $i++;  
  61.  
  62. return $decrypted_string
  63.  
  64.  
  65.  
  66.  
  67. function cryption_table ($password) { 
  68.  
  69. global $ralphabet;  
  70. global $alphabet
  71.  
  72. for$i=0; $i<strlen($password); $i++ )  
  73. {  
  74. $cur_pswd_ltr = substr($password,$i,1);  
  75. $pos_alpha_ary[] = substr(strstr($alphabet,$cur_pswd_ltr),0,strlen($ralphabet));  
  76.  
  77.  
  78. print "<table border=1 cellpadding="0" cellspacing="0">n"
  79.  
  80. print "<tr><td></td>";  
  81. for$j=0; $j<strlen($ralphabet); $j++ )  
  82. {  
  83. print "<td align="center"><font size="2" face="arial">" . substr($ralphabet,$j,1) . "</td>n";  
  84. }  
  85. print "</tr>"
  86.  
  87.  
  88. for$i=0; $i<count($pos_alpha_ary); $i++ )  
  89. {  
  90. print "<tr><td align="right"><font size="2"><b>" . ($i+1) . "|</b></font></td>";  
  91. for$k=0; $k<strlen($pos_alpha_ary[$i]); $k++ )  
  92. {  
  93. print "<td align="center"><font size="2" face="arial">" . substr($pos_alpha_ary[$i],$k,1) . "</td>n";  
  94. }  
  95. print "</tr>";  
  96.  
  97. print "</table>n"
  98.  
  99.  
  100. // end class Crypto 
  101.  
  102. // Example written by Macro Zeng  
  103. // 網絡技術主管座右銘:三人行其必有我師焉。http://m.survivalescaperooms.com 
  104. $ct = new Crypto;  
  105. //$ct->cryption_table($password);  
  106. echo "<form action=$PHP_SELF method=post>";  
  107. if ($mod == 2) {  
  108. $strtodecrypt = $ct->encrypt ($password,$strtoencrypt);  
  109. echo 'Encrypted String(加密后的字段): ';  
  110. echo "<input type=text name=strtodecrypt size=45 value=$strtodecrypt
  111. ";  
  112. echo "密碼鎖: <input type=text name=password size=6 value=$password>";  
  113. echo "<input type=submit value="Decrypt(解密)">";  
  114. }  
  115. else {  
  116. $strtoencrypt = $ct->decrypt ($password,$strtodecrypt);  
  117. echo 'String to Encrypt(需要加密的字段): ';  
  118. echo "<input type=text name=strtoencrypt size=45 value=$strtoencrypt>//開源代碼Vevb.com 
  119. ";  
  120. echo "密碼鎖: <input type=text name=password size=6 value=$password>";  
  121. echo "<input type=submit value="Encrypt(加密)">";  
  122. echo "<input type=hidden name=mod value=2>";  
  123. }  
  124. echo "</form>";

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 舒城县| 东宁县| 临海市| 黄龙县| 邵阳市| 纳雍县| 常山县| 通州区| 顺昌县| 盐城市| 新宁县| 文水县| 墨玉县| 新化县| 和龙市| 大同县| 牙克石市| 客服| 邵东县| 东至县| 新安县| 加查县| 阿拉尔市| 长岭县| 丰城市| 新乡县| 孟津县| 那曲县| 桃园县| 临夏县| 芒康县| 桐庐县| 新河县| 安多县| 河曲县| 长垣县| 罗源县| 西林县| 雷波县| 三台县| 丰都县|