Home >php教程 >php手册 >encryptlib PHP的一个加密库

encryptlib PHP的一个加密库

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-21 09:06:111247browse

加密

 function kPHPCrypt($strDataIn) {
  return StrRevCrypt(ROT13Crypt($strDataIn));
 }

 function ROT13Crypt($strDataIn) {
 
  //ABCDEFGHIJKLM
  //NOPQRSTUVWXYZ

  $newString = "";
 
  for ($i = 0; $i

   $temp = substr($strDataIn, $i, 1);
   $asc = ord($temp);

   $newChar = $temp;

   if (($asc >= 65) && ($asc     if ($asc     if ($asc >= 65 + 13) $newChar = chr($asc - 13);
   }
  
   if (($asc >= 97) && ($asc     if ($asc     if ($asc >= 97 + 13) $newChar = chr($asc - 13);
   }

   $newString = $newString . $newChar;  
  
  }

  return $newString;

 }


 function StrRevCrypt($strDataIn) {

  $newString = "";
 
  for ($i = strlen($strDataIn) - 1; $i >= 0; $i--) {
   $temp = substr($strDataIn, $i, 1);
   $newString = $newString . $temp;
  }

  return $newString;

 }

?>

 



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn