|
@@ -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); |
|
@@ -83,7 +83,7 @@ discard block |
|
|
block discarded – undo |
|
83
|
83
|
$ivr = \random_bytes(OpensslWrapper::ivsize(static::CIPHER)); |
|
84
|
84
|
|
|
85
|
85
|
// Derive key from password |
|
86
|
|
- $key = \hash_pbkdf2(static::CHKSUM, ($pass . static::CIPHER), $ivr, $cost, 0, true); |
|
|
86
|
+ $key = \hash_pbkdf2(static::CHKSUM, ($pass.static::CIPHER), $ivr, $cost, 0, true); |
|
87
|
87
|
|
|
88
|
88
|
// Encrypt the plaintext |
|
89
|
89
|
$msg = OpensslWrapper::encrypt($data, static::CIPHER, $key, $ivr); |
|
@@ -95,7 +95,7 @@ discard block |
|
|
block discarded – undo |
|
95
|
95
|
$chk = \hash_hmac(static::CHKSUM, $msg, $key, true); |
|
96
|
96
|
|
|
97
|
97
|
// Return iv + checksum + iterations + cyphertext |
|
98
|
|
- return $ivr . $chk . $itr . $msg; |
|
|
98
|
+ return $ivr.$chk.$itr.$msg; |
|
99
|
99
|
} |
|
100
|
100
|
|
|
101
|
101
|
/** |