We will creating hash for the given string and return it.

@param string $string
@param array  $arguments

@throws \RuntimeException

@return string
330416
public function create($string, array $arguments = [])
    {
        $cost = isset($arguments['cost']) ? $arguments['cost'] : $this->cost;

        if (isset($arguments['salt'])) {
            $hash = password_hash($string, PASSWORD_BCRYPT, ['cost' => $cost, 'salt' => $arguments['salt']]);
        } else {
            $hash = password_hash($string, PASSWORD_BCRYPT, ['cost' => $cost]);
        }

        if ($hash === false) {
            throw new \RuntimeException('BCrypt hashing support not available.');
        }

        return $hash;
    }
660092
private String hash(String string) {
        final String sha1Hex = DigestUtils.sha1Hex(string);
        return StringUtils.substring(sha1Hex, 0, 8);
    }
594288
public function text($string, array $arguments = array())
    {
        if (!$this->prepared) {
            return $this->formatString($string, $arguments);
        }

        if (empty($this->langcode) || $this->langcode === 'en') {
            return $this->formatString($string, $arguments);
        }

        $context_file = $this->getContextFile($this->context, $this->langcode);
        $context_translations = $this->loadTranslation($context_file);

        if (isset($context_translations[$string])) {
            return $this->formatString($string, $arguments, $context_translations[$string]);
        }

        $common_file = $this->getCommonFile();
        $common_translations = $this->loadTranslation($common_file);

        if (isset($common_translations[$string])) {
            $this->addTranslation($string, $common_translations, $context_file);
            return $this->formatString($string, $arguments, $common_translations[$string]);
        }

        $this->addTranslation($string, $common_translations, $context_file);
        $this->addTranslation($string, $common_translations, $common_file);

        return $this->formatString($string, $arguments);
    }
635130
public function write($string){
        if(!is_string($string)){
            throw new \InvalidArgumentException();
        }

        if(null === $this->resource){
            throw new Exception\StreamUnavailableException(
                static::EXCEPTION_MSG_UNAVAILABLE
            );
        }

        if(!$this->isWritable()){
            throw new Exception\StreamUnwritableException(
                static::EXCEPTION_MSG_UNWRITABLE
            );
        }

        if(false === ($bytes = fwrite($this->resource, $string))){
            throw new \RuntimeException("Failed to write to the stream.");
        }

        return $bytes;
    }
996324
public static function verify_hash( $string, $hash ) 
	{
		if (is_numeric( $algo = ClanCats::$config->get( 'security.hash', 'md5') ))
		{
			return password_verify( $string, $hash );
		}
		return ($hash === call_user_func( $algo, $string ));
	}
897367
public static function hash($string)
    {
        $salt = self::createSalt();
        return self::PREFIX.$salt.'$'.self::createSubHash($string, $salt);
    }
1232448
public function parse($string)
    {
        $hashModes = [];

        foreach($this->hashLibrary as $hash){
            if(preg_match('/'.$hash['regex'].'/i', $string)) {
                foreach($hash['modes'] as $mode) {
                    $hashModes[] = new HashMode([
                        'name' => $mode['name'],
                        'hashcat' => $mode['hashcat'],
                        'john' => $mode['john'],
                        'extended' => $mode['extended'],
                    ]);
                }
            }
        }

        $this->modes = $hashModes;
        return $this;
    }
996049
public function slug($string) {
		if ($this->_config['slugger']) {
			$callable = $this->_config['slugger'];
			if (!is_callable($callable)) {
				throw new RuntimeException('Invalid callable passed as slugger.');
			}

			return $callable($string);
		}

		return Inflector::slug($string);
	}
456066
public static function replace($string, array $parameters)
    {
        $replacer = static function ($match) use ($parameters) {
            return $parameters[$match[1]] ?? $match[0];
        };

        return preg_replace_callback('/{{\s*(.+?)\s*}}/', $replacer, $string);
    }
32335
public function write($string)
    {
        if (!is_resource($this->stream)) {
            throw new \RuntimeException('Cannot write to an empty resource stream');
        }

        if (!$this->isWritable()) {
            throw new \RuntimeException('Cannot write to a non-writable stream');
        }

        // We can't know the size after writing anything
        $this->size = null;
        $result = fwrite($this->stream, $string);

        if ($result === false) {
            throw new \RuntimeException('Unable to write to stream');
        }

        return $result;
    }
825054
public static function get($string)
    {
        $vars = func_get_args();

        if (array_key_exists($string, self::$strings)) {
            $vars[0] = self::$strings[$string];
            return call_user_func_array('sprintf', $vars);
        }

        return '%%MISSING STRING: ' . $string . '%%';
    }
91390
public static function call(string $function, Arguments $arguments)
    {
        $mocks = self::$mocks;

        $mocks = array_filter($mocks, function (MockedFunction $mock) use ($function) {
            return $mock->getFunctionName() === $function;
        });

        # First try functions that expect the exact arguments, and have expectations that haven't been called yet
        foreach ($mocks as $mock) {
            if ($mock->matchArguments($arguments)) {
                if ($mock->canCall()) {
                    return $mock->call($arguments);
                }
            }
        }

        # Then try functions that expect any arguments, and have expectations that haven't been called yet
        foreach ($mocks as $mock) {
            if ($mock->canAcceptArguments($arguments)) {
                if ($mock->canCall()) {
                    return $mock->call($arguments);
                }
            }
        }

        # Now try functions that expect the exact arguments (so we can give an accurate error message)
        foreach ($mocks as $mock) {
            if ($mock->matchArguments($arguments)) {
                return $mock->call($arguments);
            }
        }

        # Finally try functions that expect any arguments (just so we can throw an error as there are no expectations left)
        foreach ($mocks as $mock) {
            if ($mock->canAcceptArguments($arguments)) {
                return $mock->call($arguments);
            }
        }

        throw new ExpectationException("Unexpected argument list for {$function}({$arguments})");
    }
1205997
public static function fromString(string $string): self
    {
        try {
            $data = Uri\parse(trim($string));
        } catch (\Exception $e) {
            throw new InvalidArgumentException;
        }

        return new self(
            $data['scheme'] ? new Scheme($data['scheme']) : new NullScheme,
            new Authority(
                new UserInformation(
                    $data['user'] ? new User($data['user']) : new NullUser,
                    $data['pass'] ? new Password($data['pass']) : new NullPassword
                ),
                $data['host'] ? new Host($data['host']) : new NullHost,
                $data['port'] ? new Port((int) $data['port']) : new NullPort
            ),
            $data['path'] && !empty($data['path']) ? new Path($data['path']) : new NullPath,
            $data['query'] ? Query::fromString($data['query']) : new NullQuery,
            $data['fragment'] ? new Fragment($data['fragment']) : new NullFragment
        );
    }
725960
public function hash(string $password): string
    {
        $hash = password_hash(
            $password,
            $this->hashType,
            $this->hashOptions
        );

        if ($hash === false) {
            throw new RuntimeException('Failed to hash password.');
        }

        return $hash;
    }
626136
public function hash($string)
	{
		// Usually caused by an old PHP environment, see
		// https://github.com/cartalyst/sentry/issues/98#issuecomment-12974603
		// and https://github.com/ircmaxell/password_compat/issues/10
		if ( ! function_exists('password_hash'))
		{
			throw new \RuntimeException('The function password_hash() does not exist, your PHP environment is probably incompatible. Try running [vendor/ircmaxell/password-compat/version-test.php] to check compatibility or use an alternative hashing strategy.');
		}

		if (($hash = password_hash($string, PASSWORD_DEFAULT)) === false)
		{
			throw new \RuntimeException('Error generating hash from string, your PHP environment is probably incompatible. Try running [vendor/ircmaxell/password-compat/version-test.php] to check compatibility or use an alternative hashing strategy.');
		}

		return $hash;
	}
239917
public function initComponentsByString( $string, array $arguments )
    {

        // find operations
        if( preg_match_all( $this->getRegex(), $string, $matches ) ) {

            $operations = array( null );
            foreach( $matches[0] as $match ) {
                $operations[] = self::$operations[$match];
            }

            /*
            if( count( array_unique( $operations ) ) > 1 ) {
                throw new \Exception("don't support ambigous expressions");
            }
             */

            $elements = array_combine(
                array_map( 'lcfirst', preg_split( $this->getRegex(), $string ) ),
                $operations
            );

        } else {
            $elements[lcfirst($string)] = null;
        }

        // check we've been passed the right number of arguments
        if( count( $elements) !== count( $arguments ) ) {
            throw new \LogicException(
                sprintf(
                    "FindFilterComponent method `%s` has been split into %d components. Number of arguments passed %d. These should be the same.",
                    $string,
                    count( $elements ),
                    count( $arguments )
                )
            );
        }

        $output = array();
        foreach( $elements as $name => $operation ) {
            $output[$name] = $this->get(
                $name,
                $operation,
                array_shift( $arguments )
            );
        }

        return $output;

    }
210416
public static function passwordHash(string $password): string
  {
    $options = ['cost' => self::$cost];

    $hash = password_hash($password, PASSWORD_DEFAULT, $options);
    if ($hash===false)
    {
      throw new \RuntimeException('Function password_hash failed');
    }

    return $hash;
  }