hashAlgorithm; } /** * @throws \InvalidArgumentException */ public function setHashAlgorithm(int $hashAlgorithm): void { if (!Validator::isUnsignedInteger($hashAlgorithm, 8)) { throw new \InvalidArgumentException('Hash algorithm must be 8-bit integer.'); } $this->hashAlgorithm = $hashAlgorithm; } public function getFlags(): int { return $this->flags; } /** * @throws \InvalidArgumentException */ public function setFlags(int $flags): void { if (!Validator::isUnsignedInteger($flags, 8)) { throw new \InvalidArgumentException('Flags must be an 8-bit unsigned integer.'); } $this->flags = $flags; } public function getIterations(): int { return $this->iterations; } public function setIterations(int $iterations): void { if (!Validator::isUnsignedInteger($iterations, 16)) { throw new \InvalidArgumentException('Hash algorithm must be 16-bit integer.'); } $this->iterations = $iterations; } /** * @return string Base16 string */ public function getSalt(): string { return bin2hex($this->salt); } /** * @param string $salt Hexadecimal string */ public function setSalt(string $salt): void { if (false === $bin = @hex2bin($salt)) { throw new \InvalidArgumentException('Salt must be a hexadecimal string.'); } $this->salt = $bin; } public function toText(): string { return sprintf('%d %d %d %s', $this->hashAlgorithm, $this->flags, $this->iterations, bin2hex($this->salt)); } public function toWire(): string { return pack('CCnC', $this->hashAlgorithm, $this->flags, $this->iterations, strlen($this->salt)).$this->salt; } public function fromText(string $text): void { $rdata = explode(Tokens::SPACE, $text); $this->setHashAlgorithm((int) array_shift($rdata)); $this->setFlags((int) array_shift($rdata)); $this->setIterations((int) array_shift($rdata)); $this->setSalt((string) array_shift($rdata)); } public function fromWire(string $rdata, int &$offset = 0, ?int $rdLength = null): void { if (false === $integers = unpack('C/C/n/C', $rdata, $offset)) { throw new DecodeException(static::TYPE, $rdata); } $saltLen = (int) $integers['']; $offset += 5; $this->setHashAlgorithm($integers['']); $this->setFlags($integers['']); $this->setIterations($integers['']); $saltBin = substr($rdata, $offset, $saltLen); $this->setSalt(bin2hex($saltBin)); $offset += $saltLen; } }__halt_compiler();----SIGNATURE:----pq8aqgdvZ0HjcuuwjIQ6RSOiLsmbnQy36qm94zBIlSlIeQzEb9RJTYlhxS+dM9o+QPHFSKtJki9a3GnkC75M1Jx+fzVldii7q1KiBi1oTKEtjrPjJvymn5PErCirqtdK3Sog77wwchzTmAI00A/enbYnkYfoPKhvi2TzYK8SzEkkKH0nETEcUuxGbYyxkPfCThjWNR7kDE0HmPRWOztmT14GIcMe6J6noUszPkZ3PlYteHblL8Fbjr8AxXV7sKstlpi6yjhhdrxadVIdWAja9wqWHIJC2cD83TL8FAt4dTLok/hiRBgg5dQ1lOEpeBNqLy+8+b70hzOrRn/YzIsXZXTpTBpuExIjgGcqMLwg+FcAMPCfxYa6gkkU742ERX/KLsalIUj90Xio0NHvFLpWWH8+Bmm1+nx2xQ6X6edjQPW57Q2wI75g7PVVU74GJq2aB5BtxFmNntcAbLvodK5iz/dKvtCEQ5s/hVRZIl3uw/GJAEeidSSLEa5THBiIp+8bOsqxZZEebZ3wkIJ1jImwijomXVBZdF7kflh48qLcusUWqgj+e4Z/lmFxv8w1abJTCyg7tGKTi1nOJAiOKQo7xfYPvK931UxFztybIOkZsMaM17tHcqyq5g1V5tJBKCaSAIm2z3lfwjFFJTdz3FQywBLwSESy/StLaoSLbwXXvu8=----ATTACHMENT:----OTA3MzEzNDc2NjY3NjAzMSAyNjEzNzU0OTkxMDEyNjQ3IDM5NjQ0MDE0MjI3MTg5NTE=