Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

sha1 Password Hashing

  • 24-08-2007 4:42pm
    #1
    Registered Users, Registered Users 2 Posts: 7,041 ✭✭✭


    Can somebody explain to me how to use sha1() because it doesn't appear to be working very well for me. Do you get the sha1() of your password and store that in the database?

    I'm getting locked out of the page I'm trying to secure because it keeps telling my I have the wrong password.

    [PHP]
    $pass_1 = strip_tags($_POST);
    $password = mysql_real_escape_string($pass_1);
    $password_Secured = sha1($password);[/PHP]

    Also it won't echo the $password for me. It echos everything else but $password.

    Thanks,
    S.


Comments

  • Closed Accounts Posts: 89 ✭✭constellation


    I'm guessing that is PHP. Never used it but is this any use? (Have a look at second comment down).

    http://ie2.php.net/sha1


  • Closed Accounts Posts: 365 ✭✭ronanp


    If its just a login ya want, store the sha1 of the password in the database, then compare the sha1 of the POST password to the database version for authentication.

    Insert operation:

    [php]
    $insert_user = "insert into users (username,password) values ('$username', sha1('$password'))";
    [/php]

    Retrieve using a query like:

    [php]
    $password=$_POST;
    $query=mysql_query("SELECT * FROM users WHERE username = '$username' AND password = sha1('$password')");
    [/php]


Advertisement