Storing Passwords

Discussion in 'PHP' started by daryllsheridan, Apr 2, 2007.

  1. #1
    In the very early stages of designing a site and im just messing around with the login / register features

    What are people's opinions on storing passwords? From a security point of view and a general usability point of view!

    Site will be just for general info (its going to be student related) and i wont be storing any sensitive information but still know the passwords should be encrypted

    Is storing as MD5 the best solution (i know this has its own problem as regards lost passwords etc)

    Or is a two way encryption better? Havent really had much luck finding a good 2 way encryption algorithim (if anybody knows one that'd be cool)
     
    daryllsheridan, Apr 2, 2007 IP
  2. Brennan

    Brennan Notable Member

    Messages:
    3,318
    Likes Received:
    198
    Best Answers:
    0
    Trophy Points:
    240
    #2
    Sorry to burst your bubble but FF has a good storage system for passwords. Reasons I wouldn't use it: 1. FF already does it 2. I wouldn't give any password to a site to store I'd rather store it on my computer. Good Luck tho :)
     
    Brennan, Apr 2, 2007 IP
  3. manilodisan

    manilodisan Peon

    Messages:
    224
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3

    I don't think this is a good answer since he was referring on how to store the users's password on the server (is it!?). Well, I use md5 to encrypt the passwords before I store them into the database.

    INSERT INTO table_users (user, pass) VALUES ($user, md5($pass))
     
    manilodisan, Apr 2, 2007 IP
  4. Louis11

    Louis11 Active Member

    Messages:
    783
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    70
    #4
    I use MD5 also, sometimes Sha1.. sometimes both :)
     
    Louis11, Apr 2, 2007 IP
  5. srobona

    srobona Active Member

    Messages:
    577
    Likes Received:
    57
    Best Answers:
    0
    Trophy Points:
    88
    #5
    Well, md5 is a good encryption system, though I use a 2 way encryption algorithm(encrypt to store, decrypt to login).
     
    srobona, Apr 2, 2007 IP
  6. daryllsheridan

    daryllsheridan Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Yeah its for storing passwords on the server

    srobona dont suppouse you want to share your 2 way algorithim

    Havent really found any good 1's on the internet

    Kind want users to be able to retrive their passwords if lost and MD5 dosent allow for this!
     
    daryllsheridan, Apr 3, 2007 IP
  7. phper

    phper Active Member

    Messages:
    247
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #7
    Well there's always a trade-off. So you should consider what is your higher priority.

    One-way enc is faster, but since it's one way, you can't decrypt it (theoretically).
    Two-way enc is generally slower, but allows you to retrieve back the password when needed.

    For what purpose do you want to encrypt the password in the db?
     
    phper, Apr 3, 2007 IP
  8. Perrow

    Perrow Well-Known Member

    Messages:
    1,306
    Likes Received:
    78
    Best Answers:
    0
    Trophy Points:
    140
    #8
    Have a look at this discussion of storing passwords (among other things):

    http://www.sitepoint.com/article/php-security-blunders

    You should be able to correct the "collision" scenario by generating both sha and md5 versions and checking against both. Generating a string that "collides" with both should be significantly harder than just one of them.
     
    Perrow, Apr 3, 2007 IP
  9. srobona

    srobona Active Member

    Messages:
    577
    Likes Received:
    57
    Best Answers:
    0
    Trophy Points:
    88
    #9
    If you want, i can help you in this regards :)
     
    srobona, Apr 3, 2007 IP
  10. Rinox

    Rinox Peon

    Messages:
    56
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Use sha1! That is thebest solution. Search at google and you will find millions of pages describing why :)
     
    Rinox, Apr 3, 2007 IP
  11. Clive

    Clive Web Developer

    Messages:
    4,507
    Likes Received:
    297
    Best Answers:
    0
    Trophy Points:
    250
    #11
    If the "2 way encryption algorithm" means one could manually decrypt an encrypted password, then I'd simply stay away from it.

    MD5 encryption is just fine for storing passwords in a live environment, and sha1 can do the job just as well.
     
    Clive, Apr 3, 2007 IP
  12. srobona

    srobona Active Member

    Messages:
    577
    Likes Received:
    57
    Best Answers:
    0
    Trophy Points:
    88
    #12
    "2 way encryption algorithm" doesn't mean that any body can decrypt it. If you allow any one to decrypt an encrypted password, then it means nothing to use password, doesn't it?
     
    srobona, Apr 3, 2007 IP
  13. Clive

    Clive Web Developer

    Messages:
    4,507
    Likes Received:
    297
    Best Answers:
    0
    Trophy Points:
    250
    #13
    Got your point here. An easily decryptable password scheme would be similar to storing unencrypted passwords. Ironically, I've seen scripts that were not encrypting passwords which was funny.
     
    Clive, Apr 3, 2007 IP
  14. Bram Wenting

    Bram Wenting Active Member

    Messages:
    392
    Likes Received:
    52
    Best Answers:
    0
    Trophy Points:
    68
    #14
    I use MD5 in my scripts, but what do you mean with 'its own problem'?
     
    Bram Wenting, Apr 3, 2007 IP
  15. Clive

    Clive Web Developer

    Messages:
    4,507
    Likes Received:
    297
    Best Answers:
    0
    Trophy Points:
    250
    #15
    The way I prefer to be dealing with lost passwords is by resetting them, and not by retrieving them.
     
    Clive, Apr 3, 2007 IP
  16. Bram Wenting

    Bram Wenting Active Member

    Messages:
    392
    Likes Received:
    52
    Best Answers:
    0
    Trophy Points:
    68
    #16
    Yes, indeed, thats IMO the best option :)
     
    Bram Wenting, Apr 3, 2007 IP
  17. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #17
    Agreed. In fact, I see 'forced resetting' as a FEATURE, not a BUG. If someone is currently able to access my email and the forum I was using just retrieved my password, then that person would be able to access my forum account without me knowing.

    At least if they are forced to reset that password, I would possibly think that something was up when I tried to logged in myself and apparently had the wrong password...
     
    TwistMyArm, Apr 3, 2007 IP