@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | public function create($password) { |
145 | 145 | $password = $this->checkPassword($password); |
146 | 146 | $salt = $this->to64($this->generator->generate(6)); |
147 | - $prefix = static::encodeIterations($this->options['cost']) . $salt; |
|
148 | - return static::$prefix . $prefix . $this->hash($password, $salt); |
|
147 | + $prefix = static::encodeIterations($this->options['cost']).$salt; |
|
148 | + return static::$prefix.$prefix.$this->hash($password, $salt); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |
@@ -185,9 +185,9 @@ discard block |
||
185 | 185 | */ |
186 | 186 | protected function hash($password, $salt) { |
187 | 187 | $count = 1 << $this->options['cost']; |
188 | - $hash = hash($this->hashFunction, $salt . $password, true); |
|
188 | + $hash = hash($this->hashFunction, $salt.$password, true); |
|
189 | 189 | do { |
190 | - $hash = hash($this->hashFunction, $hash . $password, true); |
|
190 | + $hash = hash($this->hashFunction, $hash.$password, true); |
|
191 | 191 | } while (--$count); |
192 | 192 | return $this->to64($hash); |
193 | 193 | } |
@@ -54,7 +54,7 @@ |
||
54 | 54 | 'The hash was not created here, we cannot verify it' |
55 | 55 | ); |
56 | 56 | } |
57 | - preg_match('/^' . $prefix . '(.+)\./', $hash, $match); |
|
57 | + preg_match('/^'.$prefix.'(.+)\./', $hash, $match); |
|
58 | 58 | $salt = null; |
59 | 59 | if (isset($match[1])) { |
60 | 60 | $salt = $match[1]; |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | if ($option == 'rounds') { |
82 | 82 | if ($value < 1000 || $value > 999999999) { |
83 | 83 | throw new \InvalidArgumentException( |
84 | - 'Invalid cost parameter specified, ' . |
|
84 | + 'Invalid cost parameter specified, '. |
|
85 | 85 | 'must be between 1000 and 999999999' |
86 | 86 | ); |
87 | 87 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | protected function generateSalt() { |
94 | 94 | $salt = parent::generateSalt(); |
95 | - return '$6$rounds=' . $this->options['rounds'] . '$' . $salt; |
|
95 | + return '$6$rounds='.$this->options['rounds'].'$'.$salt; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | } |
99 | 99 | \ No newline at end of file |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | protected function hash($password, $salt, $iterations) { |
114 | 114 | $len = strlen($password); |
115 | - $text = $password . '$apr1$' . $salt; |
|
115 | + $text = $password.'$apr1$'.$salt; |
|
116 | 116 | $bin = md5($password.$salt.$password, true); |
117 | 117 | for ($i = $len; $i > 0; $i -= 16) { |
118 | 118 | $text .= substr($bin, 0, min(16, $i)); |
@@ -143,23 +143,23 @@ discard block |
||
143 | 143 | protected function convertToHash($bin, $salt) { |
144 | 144 | $tmp = '$apr1$'.$salt.'$'; |
145 | 145 | $tmp .= $this->to64( |
146 | - (ord($bin[0])<<16) | (ord($bin[6])<<8) | ord($bin[12]), |
|
146 | + (ord($bin[0]) << 16) | (ord($bin[6]) << 8) | ord($bin[12]), |
|
147 | 147 | 4 |
148 | 148 | ); |
149 | 149 | $tmp .= $this->to64( |
150 | - (ord($bin[1])<<16) | (ord($bin[7])<<8) | ord($bin[13]), |
|
150 | + (ord($bin[1]) << 16) | (ord($bin[7]) << 8) | ord($bin[13]), |
|
151 | 151 | 4 |
152 | 152 | ); |
153 | 153 | $tmp .= $this->to64( |
154 | - (ord($bin[2])<<16) | (ord($bin[8])<<8) | ord($bin[14]), |
|
154 | + (ord($bin[2]) << 16) | (ord($bin[8]) << 8) | ord($bin[14]), |
|
155 | 155 | 4 |
156 | 156 | ); |
157 | 157 | $tmp .= $this->to64( |
158 | - (ord($bin[3])<<16) | (ord($bin[9])<<8) | ord($bin[15]), |
|
158 | + (ord($bin[3]) << 16) | (ord($bin[9]) << 8) | ord($bin[15]), |
|
159 | 159 | 4 |
160 | 160 | ); |
161 | 161 | $tmp .= $this->to64( |
162 | - (ord($bin[4])<<16) | (ord($bin[10])<<8) | ord($bin[5]), |
|
162 | + (ord($bin[4]) << 16) | (ord($bin[10]) << 8) | ord($bin[5]), |
|
163 | 163 | 4 |
164 | 164 | ); |
165 | 165 | $tmp .= $this->to64( |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | if ($option == 'rounds') { |
82 | 82 | if ($value < 1000 || $value > 999999999) { |
83 | 83 | throw new \InvalidArgumentException( |
84 | - 'Invalid cost parameter specified, ' . |
|
84 | + 'Invalid cost parameter specified, '. |
|
85 | 85 | 'must be between 1000 and 999999999' |
86 | 86 | ); |
87 | 87 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | protected function generateSalt() { |
94 | 94 | $salt = parent::generateSalt(); |
95 | - return '$5$rounds=' . $this->options['rounds'] . '$' . $salt; |
|
95 | + return '$5$rounds='.$this->options['rounds'].'$'.$salt; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | } |
99 | 99 | \ No newline at end of file |
@@ -49,6 +49,6 @@ |
||
49 | 49 | |
50 | 50 | protected function generateSalt() { |
51 | 51 | $salt = parent::generateSalt(); |
52 | - return '$1$' . $salt; |
|
52 | + return '$1$'.$salt; |
|
53 | 53 | } |
54 | 54 | } |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' |
77 | 77 | . '0123456789'; |
78 | 78 | $salt = $this->generator->generateString(32, $chars); |
79 | - $hash = md5($password . $salt); |
|
80 | - return $hash . ':' . $salt; |
|
79 | + $hash = md5($password.$salt); |
|
80 | + return $hash.':'.$salt; |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | ); |
97 | 97 | } |
98 | 98 | list ($hash, $salt) = explode(':', $hash, 2); |
99 | - $test = md5($password . $salt); |
|
99 | + $test = md5($password.$salt); |
|
100 | 100 | return $this->compareStrings($test, $hash); |
101 | 101 | } |
102 | 102 |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | if (!static::detect($hash)) { |
79 | 79 | throw new \InvalidArgumentException('Hash Not Created Here'); |
80 | 80 | } |
81 | - list(, , $iterations) = explode('$', $hash, 4); |
|
81 | + list(,, $iterations) = explode('$', $hash, 4); |
|
82 | 82 | return new static(array('cost' => $iterations)); |
83 | 83 | } |
84 | 84 | |
@@ -106,6 +106,6 @@ discard block |
||
106 | 106 | $salt = parent::generateSalt(); |
107 | 107 | $prefix = static::getPrefix(); |
108 | 108 | $prefix .= str_pad($this->options['cost'], 2, '0', STR_PAD_LEFT); |
109 | - return $prefix . '$' . $salt; |
|
109 | + return $prefix.'$'.$salt; |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | \ No newline at end of file |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | public function create($password) { |
111 | 111 | $password = $this->checkPassword($password); |
112 | 112 | $size = $this->options['size'] - 8; // remove size of stored bits |
113 | - $saltSize = floor($size / 5); //Use 20% of the size for the salt |
|
113 | + $saltSize = floor($size / 5); //Use 20% of the size for the salt |
|
114 | 114 | $hashSize = $size - $saltSize; |
115 | 115 | $salt = $this->generator->generate($saltSize); |
116 | 116 | return $this->hash( |
@@ -159,8 +159,8 @@ discard block |
||
159 | 159 | protected function hash($password, $salt, $iterations, $size) { |
160 | 160 | $bit = $this->options['kdf']->derive($password, $salt, $iterations, $size); |
161 | 161 | $sig = $this->options['kdf']->getSignature(); |
162 | - $sig = '$pbkdf$' . $sig . '$' . $iterations . '$' . $size; |
|
163 | - return $sig . '$' . base64_encode($salt) . '$' . base64_encode($bit); |
|
162 | + $sig = '$pbkdf$'.$sig.'$'.$iterations.'$'.$size; |
|
163 | + return $sig.'$'.base64_encode($salt).'$'.base64_encode($bit); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | } |