code: protected function validateHashContext($context)
      {
          if (!($context instanceof HashContext) && (false === $context
              || !is_resource($context)
              || (is_resource($context) && static::HASH_CONTEXT_RESOURCE_TYPE !== get_resource_type($context)))) {
              throw new InvalidArgumentException(
                  'Unable to initialize hashing context. Your system might not support the supplied algorithm.'
              );
          }
  
          return $context;
      }
docs: Validates a given incremental hashing context.
  
  @link http://php.net/manual/en/hash.resources.php
  @param mixed $context The context to validate.
  @return resource|HashContext The incremental hashing context.
  @throws InvalidArgumentException If the hash context isn't valid.