Skip to content

Commit

Permalink
remove context funcitonality
Browse files Browse the repository at this point in the history
  • Loading branch information
Luca Castelnuovo committed Apr 29, 2021
1 parent 84faa54 commit bba6b88
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions src/Crypto/Password.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,10 @@ public function __construct(
/**
* Hash and encrypt password
*/
public function hash(
string $plaintextPassword,
?string $context = null
): string {
$plaintextPasswordWithContext = $plaintextPassword . $context;

public function hash(string $plaintextPassword): string
{
$hashedPassword = Hash::make(
string: $plaintextPasswordWithContext
string: $plaintextPassword
);

return $this->symmetric->encrypt(
Expand All @@ -39,17 +35,14 @@ public function hash(
*/
public function verify(
string $plaintextPassword,
string $encryptedHashedPassword,
?string $context = null,
string $encryptedHashedPassword
): bool {
$plaintextPasswordWithContext = $plaintextPassword . $context;

$hashedPassword = $this->symmetric->decrypt(
encryptedString: $encryptedHashedPassword
);

return Hash::verify(
string: $plaintextPasswordWithContext,
string: $plaintextPassword,
hash: $hashedPassword
);
}
Expand Down

0 comments on commit bba6b88

Please sign in to comment.