I started to use Codeigniter framework and in their new release doc's they say
DO NOT use this or any other encryption library for user password storage! Passwords must be hashed instead, and you should do that via PHP’s own Password Hashing extension.
The problem is that I use PHP 5.3 and that extension requires 5.5
What should i use for hashing in PHP 5.3?
Hashing turns your password (or any other piece of data) into a short string of letters and/or numbers using an encryption algorithm. If a website is hacked, cyber criminals don't get access to your password. Instead, they just get access to the encrypted “hash” created by your password.
php echo form_input(array('placeholder'=>'Confirm your password', 'type'=>'password', 'name'=>'confirm_password')); ?> Show activity on this post. Show activity on this post.
private function hash_password($password){
return password_hash($password, PASSWORD_BCRYPT);
}
public function registerUser($username,$email,$password){
$data = array(
'username' => $username,
'email' => $email,
'password' => $this->hash_password($password)
);
return $this->db->insert('table_name', $data);
}
PASSWORD_BCRYPT
- Use theCRYPT_BLOWFISH
algorithm to create the hash. This will produce a standardcrypt()
compatible hash using the "$2y$" identifier. The result will always be a 60 character string, or FALSE on failure.
Source: http://php.net/manual/en/function.password-hash.php
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With