You are here

public function CacheTagsHash::hashInput in Fastly 8.3

Create a hash with the given input and length.

Parameters

string $input: The input string to be hashed.

Return value

string Cryptographic hash with the given length.

1 call to CacheTagsHash::hashInput()
CacheTagsHash::cacheTagsToHashes in src/CacheTagsHash.php
Maps cache tags to hashes.

File

src/CacheTagsHash.php, line 72

Class

CacheTagsHash
Class CacheTagsHash.

Namespace

Drupal\fastly

Code

public function hashInput($input) {
  $cache_tags_length = getenv('FASTLY_CACHE_TAG_HASH_LENGTH') ?: $this->config
    ->get('cache_tag_hash_length');
  $cache_tags_length = $cache_tags_length ?: self::CACHE_TAG_HASH_LENGTH;
  return substr(base64_encode(md5($input, true)), 0, $cache_tags_length);
}