SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    John 8:24 JREAM's Avatar
    Join Date
    Sep 2007
    Location
    Florida
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP and MySQL different SHA1/MD5?

    Hey, Im boggled now!

    I am getting different passwords for the same string "jboy".

    I run this in MySQL, and it stores the output in the database:
    Code MySQL:
    Outputs: 50592fd0a0d832ff75b62ff518a1f4d2

    I echo this after typing in "jboy" in a field
    PHP Code:
    echo $this->password md5($password); 
    Outputs: 924ca8093c1d686802d2fdec66463fe8

    They don't match up, is there something I don't know about here?

  2. #2
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Are you sure there isn't any whitespace, newlines or anything of the sort that might be interfering? Use trim().

    It seems to be the PHP one that's the problem. This online generator clearly uses PHP and it outputs the same as what your MySQL is producing. So the problem must lie with whatever you're passing to to PHP's md5().

  3. #3
    John 8:24 JREAM's Avatar
    Join Date
    Sep 2007
    Location
    Florida
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks I will test this some more good to know where its coming from

  4. #4
    John 8:24 JREAM's Avatar
    Join Date
    Sep 2007
    Location
    Florida
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey you are right, it had to do with trim. Thanks dude


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •