-1

Recently I tried Hashing a password on insert in CodeIgniter as follows,

$this->load->library('PasswordHash',array(8, FALSE));
$psw = '1234';
$hash = $this->PasswordHash->HashPassword($psw); 

But I met with an Error saying "Unable to load the requested class: passwordhash". Please help me with this, or what is the best way to do it.

Dilukshan Mahendra
  • 3,230
  • 7
  • 41
  • 62

1 Answers1

0

use this

$this->load->library('phpass');

More reference: https://github.com/jenssegers/CodeIgniter-Phpass-Library

OR

Use MD5() or sha1() php function to get hash value.

Roopendra
  • 7,674
  • 16
  • 65
  • 92
Puttu
  • 98
  • 1
  • 1
  • 7
  • I did it in $this->load->library('phpass'); way, but when I validate the Login in same way it returns 0 results. why is that? – Dilukshan Mahendra Jan 30 '14 at 06:54
  • 0 means i am not get ur words explain neetly – Puttu Jan 30 '14 at 06:57
  • I created a user with the password = 'admin1234' by hashing it using phpass, where it stores the hased string in database, In user login I want to check the number of rows by matching User ID & Password(Hashing the user's input using phpass), So when it matches it should return '1'. – Dilukshan Mahendra Jan 30 '14 at 07:00