LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   php sha2() function (http://www.linuxquestions.org/questions/programming-9/php-sha2-function-4175439434/)

mscoder 11-30-2012 07:27 AM

php sha2() function
 
i am using php-mysql for a project in which i am storing
passwords in table in encrypted form.
Code:

$sql_insert = mysql_query("INSERT INTO      userinfo(full_name,id,pass,email,address,contact)
                    VALUES
                    ('$full_name','$uid',SHA2(CONCAT('$pass1','$uid'),1024),'$email','$address','$contact')");

m usind sh2() function here for encryption.My problem occurs when i try to use this function in a place thats not an sql query like:
Code:

$en_entered_pass=SHA2(CONCAT('$password','$username'),512);
Here i am trying to use this encryption and store the value in another variable but is shows error that function not recognized.why? is it not supported by php itself? if so, is there no way to store the encrypted password in some temporary variable??

graemef 12-01-2012 07:33 AM

At a guess CONCAT is a SQL function and so you want something like:
Code:

$en_entered_pass=SHA2($password + $username,512);


All times are GMT -5. The time now is 10:17 PM.