Prado\Security\TSecurityManager::computeHMAC PHP Метод

computeHMAC() защищенный Метод

Computes the HMAC for the data with {@link getValidationKey ValidationKey}.
protected computeHMAC ( $data ) : string
Результат string the HMAC for the data
    protected function computeHMAC($data)
    {
        $key = $this->getValidationKey();
        if (function_exists('hash_hmac')) {
            return hash_hmac($this->_hashAlgorithm, $data, $key);
        }
        if (!strcasecmp($this->_hashAlgorithm, 'sha1')) {
            $pack = 'H40';
            $func = 'sha1';
        } else {
            $pack = 'H32';
            $func = 'md5';
        }
        $key = str_pad($func($key), 64, chr(0));
        return $func((str_repeat(chr(0x5c), 64) ^ substr($key, 0, 64)) . pack($pack, $func((str_repeat(chr(0x36), 64) ^ substr($key, 0, 64)) . $data)));
    }