diff --git a/Library/Org/Crypt.php b/Library/Org/Crypt.php index 123ef9c7..77adcf88 100644 --- a/Library/Org/Crypt.php +++ b/Library/Org/Crypt.php @@ -20,22 +20,22 @@ class Crypt { * @return string */ static public function encrypt($data,$key,$expire=0){ - $key = md5($key); - $data = base64_encode($data); - $x=0; - $len = strlen($data); - $l = strlen($key); - $char = ''; - for ($i=0;$i< $len;$i++) { - if ($x== $l) $x=0; - $char .=substr($key,$x,1); + $key = md5($key); + $data = base64_encode($data); + $x = 0; + $len = strlen($data); + $l = strlen($key); + $char = ''; + for ($i = 0; $i< $len; $i++) { + if ($x == $l) $x = 0; + $char .=substr($key, $x, 1); $x++; } - $str = sprintf('%010d', $expire ? $expire + time():0); - for ($i=0;$i< $len;$i++) { - $str .=chr(ord(substr($data,$i,1))+(ord(substr($char,$i,1)))%256); + $str = sprintf('%010d', $expire ? $expire + time() : 0); + for ($i=0; $i< $len; $i++) { + $str .= chr(ord(substr($data, $i, 1)) + (ord(substr($char, $i, 1))) % 256); } - return str_replace('=', '',base64_encode($str)); + return str_replace('=', '', base64_encode($str)); } /** @@ -46,27 +46,27 @@ class Crypt { * @return string */ static public function decrypt($data,$key){ - $key = md5($key); - $x=0; - $data = base64_decode($data); - $expire = substr($data,0,10); - $data = substr($data,10); - if($expire>0 && $expire 0 && $expire