public function parseCompressedPublicKey($pubkey, $returnHex = false)
    {
        $prefix = substr($pubkey, 0, 2);

        if ($prefix !== '02' && $prefix !== '03') {
            return $this->prepAndClean($pubkey);
        }

        $pointX = substr($pubkey, 2);
        $pointY = substr($this->calcYfromX($pointX, $prefix), 2);

        $parsedValue = $this->prepAndClean($pointX . $pointY);

        return ($returnHex === false) ? $parsedValue : $this->encodeHex($parsedValue);
    }