Skip to content

Commit

Permalink
Added info method to hashing component.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Lundbøl committed Nov 15, 2017
1 parent 81e29b1 commit d7395d7
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 0 deletions.
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

0 comments on commit d7395d7

Please sign in to comment.