Saving passwords in database

Discussion in 'PHP' started by arp059, Aug 27, 2009.

  1. #1
    Hi all,

    I am new to PHP and MySQL things, but one thing is making me fussy while I look at twitter apps. Many such apps request our twitter username and password which is again required by them to use in php for sending tweets / follow / unfollow or anything else.

    I am quite sure you cannot use sha function to save passwords in db as the passwords need to be the original passwords of twitter which we use to login. If we save them in raw format, any web hosting person like db admin can steal everything.

    Any idea how they do it?

    Thanks in advance :)
     
    arp059, Aug 27, 2009 IP
  2. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Well, obviously they either save it in plain text or they use mcrypt before saving it to the DB. However, even mcrypt wouldn't quite work at protecting it, since if the hacker can also read the php files on the server he'll know what the decryption key is.

    In short, yes, don't give your password on sites that request it. Twitter has made available oAuth some time ago to combat this and it's the preferred method of authentication.
     
    premiumscripts, Aug 27, 2009 IP
  3. arp059

    arp059 Peon

    Messages:
    65
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks a lot, that's cool to know about and safeguary myself...
     
    arp059, Aug 27, 2009 IP