public function getPermutationNumber() { return MathsHelper::factorial(count($this->plaintext_keys)); }
public function doProcess($str, \Closure $closure = null) { $count = count($this->plaintext_keys); if ($this->flag & Cryptography::TYPE_COMBINATION) { $max = pow($count, $count); } else { $max = MathsHelper::factorial($count); } for ($i = 0; $i < $max; $i++) { try { if (!is_callable($closure)) { throw new \Exception(sprintf('"closure" argument "%s" is not callable!', is_array($closure) ? implode(' ', $closure) : $closure)); } $value = $this->doProcessCombination($i); $hash = call_user_func($closure, $value, $str); if ($hash) { return $value; } } catch (\Exception $e) { throw $e; } } return null; }