I need to encrypt a string in Symfony using bcrypt. The string is not a password it's an API Key that will be saved in database as bcrypt hash. To do that I am doing simply
$key = 'superSecretKey';
$options = array('cost' => 12);
$hash = password_hash($key, PASSWORD_BCRYPT, $options)
The problem is that password_hash() works only on PHP 5 >= 5.5.0 and I still want to preserve compatibility with PHP 5.4
Is there a "Symfony way" of encrypting string so in case of PHP version below 5.5 it will use ircmaxell/password_compat like Symfony security is doing?