@@ -39,16 +39,14 @@ public function setHostPublicEphemeralValue(string $value): void
39
39
/**
40
40
* Generate verifier using username, password and existing salt
41
41
*
42
- * @param string $I User's identity (username)
43
42
* @param string $p User's password in plaintext
44
- * @param string $s User's salt
45
43
*
46
44
* @return string
47
45
* @throws Exception
48
46
*/
49
- public function generateVerifier (string $ I , string $ p , string $ s ): string
47
+ public function generateVerifier (string $ p ): string
50
48
{
51
- $ privateKey = $ this ->computePrivateKey ($ s , $ I , $ p );
49
+ $ privateKey = $ this ->computePrivateKey ($ p );
52
50
$ verifier = $ this ->computeVerifier ($ privateKey );
53
51
54
52
return $ verifier ->toHex ();
@@ -58,26 +56,22 @@ public function generateVerifier(string $I, string $p, string $s): string
58
56
* Computes private key using salt and identity which is derived from username and password
59
57
*
60
58
* @param string $p User's password in plaintext
61
- * @param string $I User's identity (username)
62
- * @param string $s User's salt
63
59
*
64
60
* @return BigInteger
65
61
*/
66
- public function computePrivateKey (string $ p, string $ I = null , string $ s = null ): BigInteger
62
+ public function computePrivateKey (string $ p ): BigInteger
67
63
{
68
- $ salt = $ s ?? $ this ->salt ;
69
- if (empty ($ salt )) {
64
+ if (empty ($ this ->salt )) {
70
65
throw new RuntimeException ('Received empty salt. ' );
71
66
}
72
67
73
- $ username = $ I ?? $ this ->username ;
74
- if (empty ($ username )) {
68
+ if (empty ($ this ->username )) {
75
69
throw new RuntimeException ('Received empty username. ' );
76
70
}
77
71
78
- $ salt = $ this ->reverseHex ($ salt );
72
+ $ salt = $ this ->reverseHex ($ this -> salt );
79
73
$ salt = hex2bin ($ salt );
80
- $ identity = hash ('sha1 ' , strtoupper ($ username .': ' .$ p ), true );
74
+ $ identity = hash ('sha1 ' , strtoupper ($ this -> username .': ' .$ p ), true );
81
75
82
76
$ sha = sha1 ($ salt .$ identity );
83
77
$ sha = $ this ->reverseHex ($ sha );
0 commit comments