Beispiel #1
0
 /**
  * @乱序恢复,拆分出序号二进制和签名二进制并校验
  * @return boolean
  **/
 protected function splitMixedAndVerified($disruptedBin41)
 {
     $valifyResult = c_splitMixedAndVerified($disruptedBin41, $this->_salt, $this->_interference, $this->_garble_bin_length, $this->_numbering_bin_length);
     if ($valifyResult["verify"]) {
         $this->_bin_numbering = $valifyResult["_bin_numbering"];
         $this->_numbering = $valifyResult["_numbering"];
         return true;
     } else {
         return false;
     }
 }
 /**
  * @乱序恢复,拆分出序号二进制和签名二进制并校验
  * @return boolean
  **/
 protected function splitMixedAndVerified($disruptedBin41)
 {
     /* prefer to C code
             input:
                 $this->_garble_bin_length
                 $this->_numbering_bin_length
                 $this->_interference
                 $this->_salt
     
             output:
                 $this->_numbering
                 $this->_bin_numbering
             */
     /*{
                 // 获取乱序的参数
                 $arrDisruptParams = $this->getDisruptParams($this->_garble_bin_length, $this->_numbering_bin_length, $this->_interference+pow($this->getBinSum($disruptedBin41), 3));
                 // 获取原顺序的(混合签名和编号二进制)
                 $implodeBin41 = $this->recoverOrder($disruptedBin41, $arrDisruptParams);
                 list($bin_garble_to_verified, $bin_numbering) = $this->explodeBins($implodeBin41, [$this->_garble_bin_length, 0]);
     //            echo $bin_garble_to_verified."\t".$bin_numbering."\n";
                 $numbering = bindec($bin_numbering);
                 $bin_garble = $this->getGarbleBin($this->_salt, $numbering, $this->_garble_bin_length);
             }
             $this->_bin_numbering = $bin_numbering;
             $this->_numbering = $numbering;
     
     //        echo "\n".json_encode($arrDisruptParams)."\t";
     
             if($bin_garble == $bin_garble_to_verified) {
                 return true;
             } else {
                 return false;
             }*/
     /*
             array(3) {
      ["verify"]=>
      bool(true)
      ["_numbering"]=>
      int(10000)
      ["_bin_numbering"]=>
      string(27) "000000000000010011100010000"
             }
     */
     $valifyResult = c_splitMixedAndVerified($disruptedBin41, $this->_salt, $this->_interference, $this->_garble_bin_length, $this->_numbering_bin_length);
     if ($valifyResult["verify"]) {
         $this->_bin_numbering = $valifyResult["_bin_numbering"];
         $this->_numbering = $valifyResult["_numbering"];
         return true;
     } else {
         return false;
     }
 }