public function getAlgorithm()
    {
        if (null === $this->algorithm) {
            $this->reader->seek(-4, SEEK_END);

            if ('GBMB' !== $this->reader->read(4)) {
                throw SignatureException::createUsingFormat(
                    'The archive "%s" is not signed.',
                    $this->reader->getFile()
                );
            }

            $this->reader->seek(-8, SEEK_END);

            $flag = unpack('V', $this->reader->read(4));
            $flag = (int) $flag[1];

            foreach ($this->algorithms as $algorithm) {
                if ($flag === $algorithm->getFlag()) {
                    $this->algorithm = $algorithm;
                }
            }

            if (null === $this->algorithm) {
                throw SignatureException::createUsingFormat(
                    'The algorithm for the archive "%s" is not supported.',
                    $this->reader->getFile()
                );
            }
        }

        return $this->algorithm;
    }