src/web/Cookie.php
public static function salt($name, $value) {
        // Require a valid salt
        if (!static::$salt) {
            $config = Mii::$app->config('cookie');

            if ($config AND isset($config['salt'])) {
                static::$salt = $config['salt'];
            } else {
                throw new InvalidArgumentException(
                    'A valid cookie salt is required. Please set Cookie::$salt before calling this method.' .
                    'For more information check the documentation'
                );
            }
        }

        // Determine the user agent
        $agent = isset($_SERVER['HTTP_USER_AGENT']) ? strtolower($_SERVER['HTTP_USER_AGENT']) : 'unknown';

        return sha1($agent . $name . $value . static::$salt);
    }
public static function salt($name, $value) {
        // Require a valid salt
        if (!static::$salt) {
            $config = Mii::$app->config('cookie');

            if ($config AND isset($config['salt'])) {
                static::$salt = $config['salt'];
            } else {
                throw new InvalidArgumentException(
                    'A valid cookie salt is required. Please set Cookie::$salt before calling this method.' .
                    'For more information check the documentation'
                );
            }
        }

        // Determine the user agent
        $agent = isset($_SERVER['HTTP_USER_AGENT']) ? strtolower($_SERVER['HTTP_USER_AGENT']) : 'unknown';

        return sha1($agent . $name . $value . static::$salt);
    }
Generates a salt string for a cookie based on the name and value.

$salt = Cookie::salt('theme', 'red');

@param   string $name name of cookie
@param   string $value value of cookie
@return  string