Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.6] Added info method to hashing component. #22087

Merged
merged 1 commit into from
Nov 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/Illuminate/Contracts/Hashing/Hasher.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,12 @@ public function check($value, $hashedValue, array $options = []);
* @return bool
*/
public function needsRehash($hashedValue, array $options = []);

/**
* Get info about the current hashedValue.
*
* @param string $hashedValue
* @return array
*/
public function info($hashedValue);
}
12 changes: 12 additions & 0 deletions src/Illuminate/Hashing/ArgonHasher.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,16 @@ protected function processors($options)
{
return $options['processors'] ?? $this->processors;
}

/**
* Get info about the current hashedValue.
*
* @param string $hashedValue
*
* @return array
*/
public function info($hashedValue)
{
return password_get_info($hashedValue);
}
}
12 changes: 12 additions & 0 deletions src/Illuminate/Hashing/BcryptHasher.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,16 @@ protected function cost(array $options = [])
{
return $options['rounds'] ?? $this->rounds;
}

/**
* Get info about the current hashedValue.
*
* @param string $hashedValue
*
* @return array
*/
public function info($hashedValue)
{
return password_get_info($hashedValue);
}
}
5 changes: 5 additions & 0 deletions src/Illuminate/Hashing/HashManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ public function needsRehash($hashedValue, array $options = [])
return $this->driver()->needsRehash($hashedValue, $options);
}

public function info($hashedValue)
{
return $this->driver()->info($hashedValue);
}

/**
* Get the default driver name.
*
Expand Down