hash

Supported Versions: PHP 5 >= 5.1.2, PHP 7, PHP 8, PECL hash >= 1.1
Generate a hash value (message digest)
<?php hash(    string $algo,    string $data,    bool $binary = false,    array $options = []): string
<?php         if (! empty($token)) {

            $user = $this->provider->retrieveByCredentials([

                $this->storageKey => $this->hash ? hash('sha256', $token) : $token,

            ]);

        }
<?php     public function getCompiledPath($path)

    {

        return $this->cachePath.'/'.hash('xxh128', 'v2'.Str::after($path, $this->basePath)).'.'.$this->compiledExtension;

    }
<?php     public static function newComponentHash(string $component)

    {

        static::$componentHashStack[] = $hash = hash('xxh128', $component);



        return $hash;

    }
<?php             $directory = Container::getInstance()['config']->get('view.compiled')

        );



        if (! is_file($viewFile = $directory.'/'.hash('xxh128', $contents).'.blade.php')) {

            if (! is_dir($directory)) {

                mkdir($directory, 0755, true);

            }
<?php         if (! isset(static::$parentPlaceholder[$section])) {

            $salt = static::parentPlaceholderSalt();



            static::$parentPlaceholder[$section] = '##parent-placeholder-'.hash('xxh128', $salt.$section).'##';

        }



        return static::$parentPlaceholder[$section];
<?php         $provider = m::mock(UserProvider::class);

        $user = new AuthTokenGuardTestUser;

        $user->id = 1;

        $provider->shouldReceive('retrieveByCredentials')->once()->with(['api_token' => hash('sha256', 'foo')])->andReturn($user);

        $request = Request::create('/', 'GET', ['api_token' => 'foo']);



        $guard = new TokenGuard($provider, $request, 'api_token', 'api_token', $hash = true);
<?php         $model->password = 'secret';



        $this->assertEquals(hash('sha256', 'secret'), $model->password);

        $this->assertEquals(hash('sha256', 'secret'), $model->getAttributes()['password']);

        $this->assertEquals(hash('sha256', 'secret'), $model->getAttributes()['password']);

        $this->assertEquals(hash('sha256', 'secret'), $model->password);
<?php         $model->password = 'secret';



        $this->assertEquals(hash('sha256', 'secret'), $model->password);

        $this->assertEquals(hash('sha256', 'secret'), $model->getAttributes()['password']);

        $this->assertEquals(hash('sha256', 'secret'), $model->getAttributes()['password']);

        $this->assertEquals(hash('sha256', 'secret'), $model->password);
<?php         $this->assertEquals(hash('sha256', 'secret'), $model->password);

        $this->assertEquals(hash('sha256', 'secret'), $model->getAttributes()['password']);

        $this->assertEquals(hash('sha256', 'secret'), $model->getAttributes()['password']);

        $this->assertEquals(hash('sha256', 'secret'), $model->password);



        $model->password = 'secret2';
<?php         $this->assertEquals(hash('sha256', 'secret'), $model->password);

        $this->assertEquals(hash('sha256', 'secret'), $model->getAttributes()['password']);

        $this->assertEquals(hash('sha256', 'secret'), $model->getAttributes()['password']);

        $this->assertEquals(hash('sha256', 'secret'), $model->password);



        $model->password = 'secret2';
<?php         $model->password = 'secret2';



        $this->assertEquals(hash('sha256', 'secret2'), $model->password);

        $this->assertEquals(hash('sha256', 'secret2'), $model->getAttributes()['password']);

        $this->assertEquals(hash('sha256', 'secret2'), $model->getAttributes()['password']);

        $this->assertEquals(hash('sha256', 'secret2'), $model->password);
<?php         $model->password = 'secret2';



        $this->assertEquals(hash('sha256', 'secret2'), $model->password);

        $this->assertEquals(hash('sha256', 'secret2'), $model->getAttributes()['password']);

        $this->assertEquals(hash('sha256', 'secret2'), $model->getAttributes()['password']);

        $this->assertEquals(hash('sha256', 'secret2'), $model->password);

    }
<?php         $this->assertEquals(hash('sha256', 'secret2'), $model->password);

        $this->assertEquals(hash('sha256', 'secret2'), $model->getAttributes()['password']);

        $this->assertEquals(hash('sha256', 'secret2'), $model->getAttributes()['password']);

        $this->assertEquals(hash('sha256', 'secret2'), $model->password);

    }
<?php         $this->assertEquals(hash('sha256', 'secret2'), $model->password);

        $this->assertEquals(hash('sha256', 'secret2'), $model->getAttributes()['password']);

        $this->assertEquals(hash('sha256', 'secret2'), $model->getAttributes()['password']);

        $this->assertEquals(hash('sha256', 'secret2'), $model->password);

    }



    public function testSettingRawAttributesClearsTheCastCache()
<?php     public function password(): Attribute

    {

        return new Attribute(null, function ($value) {

            return hash('sha256', $value);

        });

    }