$mean ? 1 : 0; $one = $one << 1; } return (string) $bin; } /** * {@inheritDoc} */ public function hex($bin) { if (strlen($bin) !== self::SIZE * self::SIZE) { throw new LengthException('Binary length must be ' . self::SIZE * self::SIZE); } $hex = ''; foreach (str_split($bin, 4) as $bin) { $hex .= dechex(bindec($bin)); } return (string) $hex; } }