Nelmio\SecurityBundle\ContentSecurityPolicy\ShaComputer::compute PHP Method

compute() private method

private compute ( $data )
    private function compute($data)
    {
        switch ($this->getFavorite()) {
            case 'openssl':
                return sprintf('%s-%s', $this->type, base64_encode(openssl_digest($data, $this->type, true)));
            case 'hash':
                return sprintf('%s-%s', $this->type, base64_encode(hash($this->type, $data, true)));
        }
        throw new \RuntimeException('No hash function on this platform');
    }