So another stack overflow user recommended the following code to create a hash:
$password = 'my password';
$salt = strtr(base64_encode(openssl_random_pseudo_bytes(18)), '+', '.');
$pwhash = crypt($password, sprintf('$2y$%02d$%s', 13, $salt));
Is there another function for openssl_random_pseudo_bytes if I don’t have openssl installed? Does it make sense to install this, and if so, how would I do this?
Try using
mcrypt_create_iv(18). Although it is used for generating initialization vectors for encryption it uses/dev/randomby default for generating a random vector.EDIT: http://php.net/manual/en/function.mcrypt-create-iv.php