Example #1
0
 /**
  * powmod using bcmath extension
  */
 function _powmodBcmath($x, $y, $mod)
 {
     if (function_exists('bcpowmod')) {
         return bcpowmod($x, $y, $mod);
     } else {
         if (bccomp($y, 1) == 0) {
             return bcmod($x, $mod);
         } else {
             if (bcmod($y, 2) == 0) {
                 return bcmod(bcpow(Security_DSA::_powmodBcmath($x, bcdiv($y, 2), $mod), 2), $mod);
             } else {
                 return bcmod(bcmul($x, Security_DSA::_powmodBcmath($x, bcsub($y, 1), $mod)), $mod);
             }
         }
     }
 }
 function auth()
 {
     if (empty($this->response['email'])) {
         return false;
     }
     // FIXME: どの程度までチェックするのか?
     if ($this->need_email) {
         if (!strpos($this->response['email'], '@')) {
             return false;
         }
     }
     $message = $this->gen_message();
     require_once LIB_DIR . 'DSA.php';
     return Security_DSA::verify($message, $this->response['sig'], $this->regkeys);
 }