Ejemplo n.º 1
0
 public static function encrypt($text, $key)
 {
     if (!$text) {
         return NULL;
     }
     $text = strlen($text) . ':#len#:' . $text;
     $mod = new EncryptModule($key . EncryptModule::enc_string);
     $args = array();
     $tmp = unpack('c*', $text);
     for ($i = 0; $i < count($tmp); $i++) {
         $args[] = $tmp[$i + 1];
     }
     return $mod->idea_encrypt($args);
 }
Ejemplo n.º 2
0
 public function encrypt_passwd($pwd, $date)
 {
     // 防止传进来的参数格式不对
     $date = date('Y-m-d', strtotime($date));
     return EncryptModule::encrypt($pwd, $date);
 }