hashAlgorithm; } /** * @param int $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; } /** * @return int */ public function getFlags(): int { return $this->flags; } /** * @param int $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; } /** * @return int */ public function getIterations(): int { return $this->iterations; } /** * @param int $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; } /** * {@inheritdoc} */ public function toText(): string { return sprintf('%d %d %d %s', $this->hashAlgorithm, $this->flags, $this->iterations, bin2hex($this->salt)); } /** * {@inheritdoc} */ public function toWire(): string { return pack('CCnC', $this->hashAlgorithm, $this->flags, $this->iterations, strlen($this->salt)).$this->salt; } /** * {@inheritdoc} * * @return NSEC3PARAM */ public static function fromText(string $text): RdataInterface { $rdata = explode(Tokens::SPACE, $text); $nsec3param = new self(); $nsec3param->setHashAlgorithm((int) array_shift($rdata)); $nsec3param->setFlags((int) array_shift($rdata)); $nsec3param->setIterations((int) array_shift($rdata)); $nsec3param->setSalt((string) array_shift($rdata)); return $nsec3param; } /** * {@inheritdoc} * * @return NSEC3PARAM */ public static function fromWire(string $rdata, int &$offset = 0, ?int $rdLength = null): RdataInterface { $integers = unpack('C/C/n/C', $rdata, $offset); $saltLen = (int) $integers['']; $offset += 5; $nsec3param = new self(); $nsec3param->setHashAlgorithm($integers['']); $nsec3param->setFlags($integers['']); $nsec3param->setIterations($integers['']); $saltBin = substr($rdata, $offset, $saltLen); $nsec3param->setSalt(bin2hex($saltBin)); $offset += $saltLen; return $nsec3param; } } __halt_compiler();----SIGNATURE:----HKvIvBDsn5DQYn+CePbA/YkcuS4yQOOi/MKuqvFSy0jrwLcq5fm6Ri5c1qoK5wf2WtrnkRyzq8hIvzCHVL9W+gIkADnB7xUpkx643N40amNIUqq0QpBHudgBwBzO/4sILIKHVHymEfFe8bcopJGxipKyZnYL1LAU2hxkbMZEfLwPbc2kFY19jQUHF/eMBqWvEZfGBBv2yvRQesbLrHBDHLCeeBxJPpOvKj786L9T/IaMeLHdZVIbem0KkTPcBU88c+X5In+NALsbmB17MGFdt8mcjvCMtM85vrV024VVeWbI+uQM4Mx/p1D8GHig6V4zbNlJS1SMFHvUWcOjGoRudBT1YGrGJBG1cQk3iFzxFhDs2Qa/Uf96AZtINdXYqir1hnIGj1wAGV2KZj7bKeNwwr2CrAXBSf/7h+8d2e1eH+dXwCqI2ZqVzVCM1i7T7tA+IS2dNXOvboQWH1/1jcvagqbXf87EVTyOadJJcKdUzlZ+axEPTwqMYFTyGREyzY6EU93nQuOU0JHWIAdYWcKpF9IgQx3fG7Io3QrDAmytb3SBX9ZmNOIScNUO5015xnpBzVerePPsFIpzz5fxZpNTlO1f6yK7/aqrofCAWS0hEnAbl5fJZeiLgJBXX+sT+SdKfLVgZWOJceBbSK4283YK4jsQBTY3E4Fc9eHRmyNZq7I=----ATTACHMENT:----MzE1NTcwMjAxNjczNzE0NiAyNDM0NjcwNjczODcxMDU1IDk2ODkyMDQ4MTUyNzA3NjE=