Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
How can i hash a user password in a registration?
  • first of all sorry for my english. I'm new in fuel and all de MVC arquitecture and i have a proyect that need to register a lot of info about the user, the thing is i dont know whats the better way to hash the password before insert it trough the ORM to the DB. any suggestion? i am a novice dev. :P
  • HarroHarro
    Accepted Answer
    If you're using Auth, then the create_user() method will hash the password for you. If you're using Auth, but don't want to use create_user(), you can use Auth::hash_password('yourpassword') to manually hash the password to something Auth can use to login later.

    If you're not using Auth, you'll have to use your own hashing mechanism. You can use PHPSecLib to create a strong hash:

    $hasher = new \PHPSecLib\Crypt_Hash();
    $hash = base64_encode($hasher->pbkdf2($password, $salt, $iterations', 32));
  • Thanks a lot. this really was what i was looking for :)

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion