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:----Y4DquWUPJcKV75kCoVn4PV/hYr+/gMmHifm1U8OjiP9vg+ZFHDUcYJkgVqPUNCo4Ti79WeH6j/MT4kQUMLeKXtHSisR+iXc5Qp4QAtoxoHoJfdG0XRmu7rMxTadF+VvCtrd7cwK1WLQVCSNdoMutItfE057N/40YqIJvptRmTiX++LAXirjKD2yCnFFZHwaB6fnTsXid/viNfsxXGSepM5UeQ7ZUhIhbC+ZHswNWJph/pkeaE1F72Zu7rGqxNTIteGqvJhMGfPzH2KGCb2hskGtyRa6UepYAVv66pQMEhYBz8dw2DlNuZUSitR29REYUWuiAAEWX0/umGCL1CJJ1s7E1DOZIevqZ/noEowFNvQZunAkJtJCl4UR8eVaASv+BLLP/5yYtln88Gv4+sPxvD8LhPhMVyClWJ03CZXsVo8//YjECoNCOVYuK/dihjLieH455TOT1SH6pgqKwhs2t1fJ5nkQEmh27ejnQLgh4nqlZxz7gX0qdYjlGxssbtedzn8ZBh4vct/53PJGiz2K520/PQZR8kzOtqBqtYD83g2nePQxMEnTjhRMN5yhOFvTPuWRtcoLeHfZzxM915iaxMJsfjHKtDcnRNbaN0QTxkoT7iwdkXYcn34Lp+mYGHV+lXhQrSPQGwq+YgjZQTZ5bu9JvAbbuA8yuvju+dblpjJw=----ATTACHMENT:----ODE5NDY1NDYyODc2MjEwMiAxNzI3ODk4MDc5NDQxNTgyIDIwNTI1NzUyOTg3NjEwNDM=