Skip to content

Latest commit

 

History

History
executable file
·
16 lines (11 loc) · 709 Bytes

README.md

File metadata and controls

executable file
·
16 lines (11 loc) · 709 Bytes

Codeigniter bcrypt Library

Simple bcrypt hashing library helper for Codeigniter.

Crypting

This function will help you crypt any string.

$input_password = $this->input->post('input-password');
$hashed_password = $this->bcrypt->hash($password);

Decrypting (comparing)

After you got the crypted string (method above), you can't reverse it, but can compare (and validate) the source string from the hashed one. The compare method receives 2 strings, the original and the hashed one. Returns true if the second was generated by the first one.

$user_password = $this->input->post('input-password');
$is_really_the_password = $this->CI->bcrypt->compare($password_string, $this->user_data->password);