Pressroom template verwijderd, website naar root van repo
This commit is contained in:
93
vendor/laravel/framework/src/Illuminate/Hashing/BcryptHasher.php
vendored
Executable file
93
vendor/laravel/framework/src/Illuminate/Hashing/BcryptHasher.php
vendored
Executable file
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Hashing;
|
||||
|
||||
use RuntimeException;
|
||||
use Illuminate\Contracts\Hashing\Hasher as HasherContract;
|
||||
|
||||
class BcryptHasher implements HasherContract
|
||||
{
|
||||
/**
|
||||
* Default crypt cost factor.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $rounds = 10;
|
||||
|
||||
/**
|
||||
* Hash the given value.
|
||||
*
|
||||
* @param string $value
|
||||
* @param array $options
|
||||
* @return string
|
||||
*
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public function make($value, array $options = [])
|
||||
{
|
||||
$hash = password_hash($value, PASSWORD_BCRYPT, [
|
||||
'cost' => $this->cost($options),
|
||||
]);
|
||||
|
||||
if ($hash === false) {
|
||||
throw new RuntimeException('Bcrypt hashing not supported.');
|
||||
}
|
||||
|
||||
return $hash;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the given plain value against a hash.
|
||||
*
|
||||
* @param string $value
|
||||
* @param string $hashedValue
|
||||
* @param array $options
|
||||
* @return bool
|
||||
*/
|
||||
public function check($value, $hashedValue, array $options = [])
|
||||
{
|
||||
if (strlen($hashedValue) === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return password_verify($value, $hashedValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given hash has been hashed using the given options.
|
||||
*
|
||||
* @param string $hashedValue
|
||||
* @param array $options
|
||||
* @return bool
|
||||
*/
|
||||
public function needsRehash($hashedValue, array $options = [])
|
||||
{
|
||||
return password_needs_rehash($hashedValue, PASSWORD_BCRYPT, [
|
||||
'cost' => $this->cost($options),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the default password work factor.
|
||||
*
|
||||
* @param int $rounds
|
||||
* @return $this
|
||||
*/
|
||||
public function setRounds($rounds)
|
||||
{
|
||||
$this->rounds = (int) $rounds;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the cost value from the options array.
|
||||
*
|
||||
* @param array $options
|
||||
* @return int
|
||||
*/
|
||||
protected function cost(array $options = [])
|
||||
{
|
||||
return isset($options['rounds']) ? $options['rounds'] : $this->rounds;
|
||||
}
|
||||
}
|
||||
37
vendor/laravel/framework/src/Illuminate/Hashing/HashServiceProvider.php
vendored
Executable file
37
vendor/laravel/framework/src/Illuminate/Hashing/HashServiceProvider.php
vendored
Executable file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Hashing;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class HashServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Indicates if loading of the provider is deferred.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $defer = true;
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->app->singleton('hash', function () {
|
||||
return new BcryptHasher;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provides()
|
||||
{
|
||||
return ['hash'];
|
||||
}
|
||||
}
|
||||
35
vendor/laravel/framework/src/Illuminate/Hashing/composer.json
vendored
Executable file
35
vendor/laravel/framework/src/Illuminate/Hashing/composer.json
vendored
Executable file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"name": "illuminate/hashing",
|
||||
"description": "The Illuminate Hashing package.",
|
||||
"license": "MIT",
|
||||
"homepage": "https://laravel.com",
|
||||
"support": {
|
||||
"issues": "https://github.com/laravel/framework/issues",
|
||||
"source": "https://github.com/laravel/framework"
|
||||
},
|
||||
"authors": [
|
||||
{
|
||||
"name": "Taylor Otwell",
|
||||
"email": "taylor@laravel.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.6.4",
|
||||
"illuminate/contracts": "5.4.*",
|
||||
"illuminate/support": "5.4.*"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Illuminate\\Hashing\\": ""
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "5.4-dev"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"sort-packages": true
|
||||
},
|
||||
"minimum-stability": "dev"
|
||||
}
|
||||
Reference in New Issue
Block a user