O'Reilly logo

CodeIgniter 2 Cookbook by Rob Foster

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Generating passwords with CodeIgniter

There are two ways to explain this. As this is a recipe book, I'm going to give you the structure for a user to register (part of this process is creating a hash from the password the user will provide) and also the signin form (part of this process is to validate a password against a hash). But I'm aware that you won't necessarily need all the following files, the lines which focus on password hashing in the following examples. This way, you can quickly see how the process works and apply it to your situation.

Getting ready

First, let's make the database schema to support the recipe. If you have your own table ready and are just looking for the hashing code, you can probably skip this part. Otherwise, copy ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required