@@ -24,13 +24,14 @@ discard block |
||
24 | 24 | |
25 | 25 | public static function verify($plaintext, $ciphertext) |
26 | 26 | { |
27 | - if(version_compare(PHP_VERSION, '5.6.0', '>=')){ |
|
27 | + if(version_compare(PHP_VERSION, '5.6.0', '>=')) { |
|
28 | 28 | return hash_equals($ciphertext, crypt($plaintext, $ciphertext)); |
29 | 29 | } |
30 | 30 | return crypt($plaintext, $ciphertext) == $ciphertext; |
31 | 31 | } |
32 | 32 | |
33 | - public static function generateSalt(){ |
|
33 | + public static function generateSalt() |
|
34 | + { |
|
34 | 35 | /* To generate the salt, first generate enough random bytes. Because |
35 | 36 | * base64 returns one character for each 6 bits, the we should generate |
36 | 37 | * at least 22*6/8=16.5 bytes, so we generate 17. Then we get the first |
@@ -38,7 +39,7 @@ discard block |
||
38 | 39 | */ |
39 | 40 | $bytes = openssl_random_pseudo_bytes(17); |
40 | 41 | |
41 | - if($bytes === false){ |
|
42 | + if($bytes === false) { |
|
42 | 43 | throw new RuntimeException('Unable to generate a random string'); |
43 | 44 | } |
44 | 45 |