includes/rijndael.php
changeset 440 105457df35e5
parent 286 b2f985e4cef3
child 458 c433348f3628
equal deleted inserted replaced
339:5d62ef764b0d 440:105457df35e5
     7  * @package phijndael
     7  * @package phijndael
     8  * @author Fritz Schneider
     8  * @author Fritz Schneider
     9  * @author Dan Fuhry
     9  * @author Dan Fuhry
    10  * @license BSD-style license
    10  * @license BSD-style license
    11  */
    11  */
    12 
       
    13 error_reporting(E_ALL);
       
    14 
    12 
    15 define ('ENC_HEX', 201);
    13 define ('ENC_HEX', 201);
    16 define ('ENC_BASE64', 202);
    14 define ('ENC_BASE64', 202);
    17 define ('ENC_BINARY', 203);
    15 define ('ENC_BINARY', 203);
    18 
    16 
  1026       while ($n >= 2147483648) $n -= 4294967296;
  1024       while ($n >= 2147483648) $n -= 4294967296;
  1027       while ($n <= -2147483649) $n += 4294967296;
  1025       while ($n <= -2147483649) $n += 4294967296;
  1028       return (int)$n;
  1026       return (int)$n;
  1029   }
  1027   }
  1030    
  1028    
  1031   function encrypt($str, $key) {
  1029   // The third parameter is to ensure compatibility with php 6.0-dev
       
  1030   function encrypt($str, $key, $unused = ENC_HEX) {
  1032       if ($str == "")
  1031       if ($str == "")
  1033       {
  1032       {
  1034           return "";
  1033           return "";
  1035       }
  1034       }
  1036       $v = $this->str2long($str, true);
  1035       $v = $this->str2long($str, true);
  1060           $z = $v[$n] = $this->int32($v[$n] + $mx);
  1059           $z = $v[$n] = $this->int32($v[$n] + $mx);
  1061       }
  1060       }
  1062       return $this->long2str($v, false);
  1061       return $this->long2str($v, false);
  1063   }
  1062   }
  1064    
  1063    
  1065   function decrypt($str, $key) {
  1064   // The third parameter is to ensure compatibility with php 6.0-dev
       
  1065   function decrypt($str, $key, $unused = ENC_HEX) {
  1066       if ($str == "") {
  1066       if ($str == "") {
  1067           return "";
  1067           return "";
  1068       }
  1068       }
  1069       $v = $this->str2long($str, false);
  1069       $v = $this->str2long($str, false);
  1070       $k = $this->str2long($key, false);
  1070       $k = $this->str2long($key, false);