Completed
Pull Request — master (#15)
by Michael
01:42
created
src/Hash.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -70,9 +70,9 @@
 block discarded – undo
70 70
      */
71 71
     private static function cost(int $cost): int
72 72
     {
73
-		if ($cost < 0 || $cost > \pow(2, 32)) {
74
-			throw new \InvalidArgumentException("Hashing cost parameter must between 0 and 2^32");
75
-		}
73
+        if ($cost < 0 || $cost > \pow(2, 32)) {
74
+            throw new \InvalidArgumentException("Hashing cost parameter must between 0 and 2^32");
75
+        }
76 76
 		
77 77
         return $cost;
78 78
     }
Please login to merge, or discard this patch.
src/OpensslBridge.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         $cost = \unpack('L*', $itr ^ \hash_hmac(static::CHKSUM, $ivr, $pass, true))[1];
58 58
 
59 59
         // Derive key from password
60
-        $key = \hash_pbkdf2(static::CHKSUM, ($pass . static::CIPHER), $ivr, $cost, 0, true);
60
+        $key = \hash_pbkdf2(static::CHKSUM, ($pass.static::CIPHER), $ivr, $cost, 0, true);
61 61
 
62 62
         // Calculate verification checksum
63 63
         $chk = \hash_hmac(static::CHKSUM, $msg, $key, true);
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
         $ivr = \random_bytes(OpensslWrapper::ivsize(static::CIPHER));
86 86
 
87 87
         // Derive key from password
88
-        $key = \hash_pbkdf2(static::CHKSUM, ($pass . static::CIPHER), $ivr, $cost, 0, true);
88
+        $key = \hash_pbkdf2(static::CHKSUM, ($pass.static::CIPHER), $ivr, $cost, 0, true);
89 89
 
90 90
         // Encrypt the plaintext
91 91
         $msg = OpensslWrapper::encrypt($data, static::CIPHER, $key, $ivr);
@@ -97,6 +97,6 @@  discard block
 block discarded – undo
97 97
         $chk = \hash_hmac(static::CHKSUM, $msg, $key, true);
98 98
 
99 99
         // Return iv + checksum + iterations + cyphertext
100
-        return $ivr . $chk . $itr . $msg;
100
+        return $ivr.$chk.$itr.$msg;
101 101
     }
102 102
 }
Please login to merge, or discard this patch.