| @@ -166,9 +166,9 @@ | ||
| 166 | 166 | if ( ! $cipher_text ) { |
| 167 | 167 | return false; |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | - $hash = hash_hmac( 'sha256', $iv . $cipher_text, $secret_key, true ); | |
| 170 | + $hash = hash_hmac( 'sha256', $cipher_text, $secret_key, true ); | |
| 171 | 171 | |
| 172 | 172 | return base64_encode( $iv . $hash . $cipher_text ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode |
| 173 | 173 | } |
| 174 | 174 | |
| @@ -194,9 +194,9 @@ | ||
| 194 | 194 | $iv_length = openssl_cipher_iv_length( 'AES-256-CBC' ); |
| 195 | 195 | $iv = substr( $value, 0, $iv_length ); |
| 196 | 196 | $hash = substr( $value, $iv_length, 32 ); |
| 197 | 197 | $cipher_text = substr( $value, $iv_length + 32 ); |
| 198 | - $hash_comp = hash_hmac( 'sha256', $iv . $cipher_text, $secret_key, true ); | |
| 198 | + $hash_comp = hash_hmac( 'sha256', $cipher_text, $secret_key, true ); | |
| 199 | 199 | |
| 200 | 200 | if ( hash_equals( $hash, $hash_comp ) ) { |
| 201 | 201 | $decrypted_value = openssl_decrypt( $cipher_text, 'AES-256-CBC', $secret_key, OPENSSL_RAW_DATA, $iv ); |
| 202 | 202 | } |