+ Reply to Thread
Results 1 to 6 of 6

Thread: Password handling

  1. #1
    espfutbol98's Avatar
    espfutbol98 is offline x10 Sophmore espfutbol98 is an unknown quantity at this point
    Join Date
    Apr 2009
    Location
    Zagreb... želim
    Posts
    200

    Password handling

    I was reading one of my scripts and I found an unfamiliar function. I went to the php manual and it wasn't there either. It is the PASSWORD() function and it works like md5() or sha1() but I don't know how the security compares to other ones. If it is not as secure as others, please recommend me one.

  2. #2
    Twinkie is offline Banned Twinkie is an unknown quantity at this point
    Join Date
    Sep 2007
    Location
    Ft. Lauderdale, Florida
    Posts
    1,389

    Re: Password handling

    I get a function undefined error.

    Hashing strength is compared by how long the hash string is produced as bits. The more bits a function utilizes, the less chance of a collisions, or finding out the original password.

  3. #3
    espfutbol98's Avatar
    espfutbol98 is offline x10 Sophmore espfutbol98 is an unknown quantity at this point
    Join Date
    Apr 2009
    Location
    Zagreb... želim
    Posts
    200

    Re: Password handling

    It works perfectly here:
    PHP Code:
    <?php
    //...
    $query "SELECT username, password, first_name FROM user_info " .
               
    "WHERE username = '" $_POST['username'] . "' " .
               
    "AND password = (PASSWORD('" $_POST['password'] . "'))";
    //...
    ?>

  4. #4
    Twinkie is offline Banned Twinkie is an unknown quantity at this point
    Join Date
    Sep 2007
    Location
    Ft. Lauderdale, Florida
    Posts
    1,389

    Re: Password handling

    Oh, you might have mentioned it was a MySQL function ;)

    It has the same bits and strength compared to sha1. I would recommend sticking with sha1 so you has perform password comparisons in your script without having to run multiple SELECT PASSWORD("[DATA]"); queries.

  5. #5
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: Password handling

    If you're hashing passwords, make sure you use salt. System wide salt prevents rainbow attacks (attacks using a standard dictionary precomputed before getting your system's password data). If you only use system salt, a cracker can still produce a rainbow table for your system. Using both system salt and a per-user salt (the username works for this) prevents dictionary attacks in general.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

  6. #6
    espfutbol98's Avatar
    espfutbol98 is offline x10 Sophmore espfutbol98 is an unknown quantity at this point
    Join Date
    Apr 2009
    Location
    Zagreb... želim
    Posts
    200

    Re: Password handling

    Oh, it's SQL, I thought it was php. Okay, I'll read up on salting hand hashing. Thanks guys.

+ Reply to Thread

Similar Threads

  1. Password changing headache
    By rodney in forum Free Hosting
    Replies: 3
    Last Post: 02-05-2009, 09:51 AM
  2. Password Hashing In CMS-A Detailled Look
    By balaji2u in forum Tutorials
    Replies: 5
    Last Post: 11-15-2008, 10:47 AM
  3. Can't reset hosting account's password
    By ysm79 in forum Free Hosting
    Replies: 1
    Last Post: 04-20-2008, 11:44 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers