using variable instead of hardcoded hashing method

This commit is contained in:
Jeroen De Meerleer 2021-05-20 12:22:47 +02:00
parent bfeb97c441
commit 61922c8ba7
Signed by: JeroenED
GPG Key ID: 28CCCB8F62BFADD6
1 changed files with 1 additions and 1 deletions

View File

@ -13,7 +13,7 @@ class Secret
$iv = openssl_random_pseudo_bytes(16);
$ciphertext = openssl_encrypt($plaintext, $method, $key, OPENSSL_RAW_DATA, $iv);
$hash = hash_hmac('sha256', $ciphertext . $iv, $key, true);
$hash = hash_hmac($_ENV['HASHING_METHOD'], $ciphertext . $iv, $key, true);
return $iv . $hash . $ciphertext;
}