CodeIgniter Forums
Don't understand why CI_Encrypt is throwing an error when I invoke sha1()? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Don't understand why CI_Encrypt is throwing an error when I invoke sha1()? (/showthread.php?tid=60904)



Don't understand why CI_Encrypt is throwing an error when I invoke sha1()? - El Forum - 07-28-2014

[eluser]mtpultz[/eluser]
Hi, I'm new to CodeIgniter and I've been trying to use the Encrypt library, specifically the sha1 function to hash a user password. After the user registers I grab the password and pass it to sha1(). If I print the password and die, it prints the password, but if left to execute sha1 throws the error below. Anyone know what I'm doing wrong, or not doing? I also checked to see that the password is_string(). Also, the value returned from sha1() appears to always be 1.

// Code Snippet
Code:
$hash = $this->encrypt-sha1($this->input->post('password1'));

// Thrown Error
A PHP Error was encountered
Severity: Notice
Message: Object of class CI_Encrypt could not be converted to int


Don't understand why CI_Encrypt is throwing an error when I invoke sha1()? - El Forum - 07-28-2014

[eluser]mtpultz[/eluser]
UGH! Never mind, it was a typo just before sha1(). That is an hour+ that I won't get back.