Encode the image in ASCII hexadecimal by looping over every pixel.

@return string
350790
protected function encode(): string
    {
        $bitmap = null;
        $lastRow = null;

        for ($y = 0; $y < $this->height; $y++) {
            $bits = null;

            for ($x = 0; $x < $this->width; $x++) {
                $bits .= $this->decoder->getBitAt($x, $y);
            }

            $bytes = str_split($bits, 8);
            $bytes[] = str_pad(array_pop($bytes), 8, '0');

            $row = null;

            foreach ($bytes as $byte) {
                $row .= sprintf('%02X', bindec($byte));
            }

            $bitmap .= $this->compress($row, $lastRow);
            $lastRow = $row;
        }

        return $bitmap;
    }
662453
public function getImgSrc() {
        if ($this->type == 'image' && $this->img_src == null) {
            $this->img_src = 'data:'.$this->content_type.';base64,'.base64_encode($this->content);
        }
        return $this->img_src;
    }
49842
public function toHex()
    {
        $H = $this->values['hue'] / 360;
        $S = $this->values['saturation'];
        $L = $this->values['lightness'];

        if ($S == 0) {
            $r = $L * 255;
            $g = $L * 255;
            $b = $L * 255;
        } else {
            $var_2 = ($L < 0.5) ?  $L * (1 + $S) : ($L + $S) - ($S * $L);

            $var_1 = 2 * $L - $var_2;

            $r = round(255 * $this->hueToRgb($var_1, $var_2, $H + (1 / 3)));
            $g = round(255 * $this->hueToRgb($var_1, $var_2, $H));
            $b = round(255 * $this->hueToRgb($var_1, $var_2, $H - (1 / 3)));
        }

        $hex = array(
            dechex($r),
            dechex($g),
            dechex($b)
        );

        //Make sure the hex is 6 digit
        foreach ($hex as $key => $value) {
            $hex[$key] = strlen($value) === 1 ? '0' . $value : $value ;
        }

        return implode('', $hex);
    }
544404
public static function uid10(): string
    {
        $converted = base_convert(self::$hex_chars[random_int(0, 15)] . uniqid('', true) . self::$hex_chars[random_int(0, 15)], 16, 10);
        $res = '';

        for ($i = floor(log10((float)$converted) / 1.7923916894983); $i >= 0; --$i) {
            // Random index
            $j = 62 ** $i;
            $a = (int)floor($converted / $j);
            $res .= self::$alphanum_chars[$a];

            $converted -= $a * $j;
        }

        return sprintf('%010s', $res);
    }
131077
public function toBytes()
    {
        if (0 === gmp_cmp($this->value, gmp_init(0))) {
            return '';
        }

        $temp = gmp_strval(gmp_abs($this->value), 16);
        $temp = mb_strlen($temp, '8bit') & 1 ? '0'.$temp : $temp;
        $temp = hex2bin($temp);

        return ltrim($temp, chr(0));
    }
419922
public function toBinary()
    {
        $bytes = '';

        foreach (str_split($this->value, 8) as $piece) {
            $bytes .= chr(bindec($piece));
        }

        return $bytes;
    }
1233727
public function getBytes()
    {
        $bytes = '';

        foreach (range(-2, -32, 2) as $step) {
            $bytes = chr(hexdec(substr($this->getHex(), $step, 2))) . $bytes;
        }

        return $bytes;
    }
392085
public function getBytes()
    {
        $bytes = '';

        $hex = $this->toString();
        $hex = str_replace('-', '', $hex);

        foreach (range(-2, -32, 2) as $step) {
            $bytes = chr(hexdec(substr($hex, $step, 2))) . $bytes;
        }

        return $bytes;
    }
396909
public function getMacKey()
    {
        $key = $this->config['key'];

        $hexStrKey = substr($key, 0, 38);
        $hexFinal = "" . substr($key, 38, 2) . "00";

        $cca0 = ord($hexFinal);

        if ($cca0 > 70 && $cca0 < 97) {
            $hexStrKey .= chr($cca0 - 23) . substr($hexFinal, 1, 1);
        } else {
            if (substr($hexFinal, 1, 1) == "M") {
                $hexStrKey .= substr($hexFinal, 0, 1) . "0";
            } else {
                $hexStrKey .= substr($hexFinal, 0, 2);
            }
        }

        return pack("H*", $hexStrKey);
    }
1038819
public function getEncoded()
    {
        $data = serialize($this->data);
        if (function_exists('gzdeflate'))
        {
            $data = gzdeflate($data);
        }
        $data = base64_encode($data);
        $data .= $this->signature($data);
        return $data;
    }
966414
public function encode()
    {
    	foreach ($this->body as $key => $value) {
    		$result[] = $this->replaceText($value);
    	}

    	return implode('', $result);
    }
363763
public function getPixelFormat()
    {
        if ($this->pixelFormat === null) {
            $match = [];
            preg_match(self::$REGEX_PIXEL_FORMAT, $this->output, $match);
            $this->pixelFormat = array_key_exists(1, $match) ? trim($match[1]) : '';
        }

        return $this->pixelFormat;
    }
628808
public function toHexString() : string
    {
        return '#' . sprintf('%02x', $this->red) . sprintf('%02x', $this->green) . sprintf('%02x', $this->blue);
    }
360126
public function generateSigninInput()
    {
        $base64payload = $this->encoder->encode(json_encode($this->getPayload(), JSON_UNESCAPED_SLASHES));
        $base64header = $this->encoder->encode(json_encode($this->getHeader(), JSON_UNESCAPED_SLASHES));

        return sprintf('%s.%s', $base64header, $base64payload);
    }
102114
protected function _encode()
    {
        $encode = $this->settings['encode'];
        $length = $this->settings['encodeLength'];

        if( ! IS::hash($encode) )
        {
            $encode = 'md5';
        }

        return substr(Encode\Type::create(uniqid(rand()), $encode), 0, $length).'-';
    }
1197571
public static function sequential(): string
	{
		[$usec, $sec] = explode(' ', microtime());

		$random = hex2bin(dechex($sec . substr($usec, 2, 5)) . bin2hex(random_bytes(10)));

		$random[6] = chr(ord($random[6]) & 0x0f | 0x40);

		$random[8] = chr(ord($random[8]) & 0x3f | 0x80);

		return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($random), 4));
	}
593142
public function encode() : string
    {
        $segments = [
            $this->header->encode(),
            $this->payload->encode(),
            self::base64UrlEncode($this->signature)
        ];

        return implode('.', $segments);
    }