if ($a == 0) { throw new Exception(); } return $this->expTable[$this->size - $this->logTable[$a] - 1]; } /** * @return product of a and b in GF(size) */ function multiply($a, $b) { if ($a == 0 || $b == 0) { return 0; } return $this->expTable[($this->logTable[$a] + $this->logTable[$b]) % ($this->size - 1)]; } public function getSize() { return $this->size; } public function getGeneratorBase() { return $this->generatorBase; } // @Override public function toString() { return "GF(0x" . dechex(intval($this->primitive)) . ',' . $this->size . ')'; } } GenericGF::Init();