php加密程序

六月 22, 2019 | views
Comments 0

  1. <?php 
  2.   //加密 
  3.   function jiami($data,$psw){ 
  4.       for($i=0,$j=0;$i<strlen($data);$i++,$j++){ 
  5.           $middle = ord(substr($data,$i,1)) +  
  6.            ord(substr($psw,$j,1)); 
  7.     if ($j > strlen($psw)){ 
  8.      $j=0;//开源代码phpfensi.com 
  9.     } 
  10.           $str .=chr($middle); 
  11.       } 
  12.    return($str); 
  13.   } 
  14.   //解密 
  15.   function jiemi($data,$psw){ 
  16.    for($i=0,$j=0;$i<strlen($data);$i++,$j++){ 
  17.           $middle = ord(substr($data,$i,1)) -  
  18.            ord(substr($psw,$j,1)); 
  19.     if ($j > strlen($psw)){ 
  20.      $j=0; 
  21.     } 
  22.           $str .=chr($middle); 
  23.       } 
  24.    return($str); 
  25.   } 
  26. ?> 



zend