Quick php/Myql question. Likely stupid and easy

Discussion in 'PHP' started by Nigel Lew, Jan 6, 2011.

  1. #1
    Hi folks, I have a client who hurled a bunch of work at me and was simply moving a script of some sort.

    Can some explain to me what this function means..

    to add an admin, use the hash md5(sha1("password"));
    put all the information in the admins table

    I tried adding the pass as md5 but when I go back and look via phpmyadmin its something different. Same thing happens if if I try something encrpyted with sha1

    What am I missing here?

    thanks,
    Nigel
     
    Nigel Lew, Jan 6, 2011 IP
  2. mcfc4eva

    mcfc4eva Well-Known Member

    Messages:
    602
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    110
    #2
    The password is encrypted with sha1 first, and then this is encrypted with md5 hash.

    Example if the password was "hello":

    If you encrypted it with just sha1 then you would get the MIDDLE result above. If you just encrypted it with just md5 you would get the result below:

    --Mike
     
    Last edited: Jan 6, 2011
    mcfc4eva, Jan 6, 2011 IP
    Nigel Lew likes this.
  3. Nigel Lew

    Nigel Lew Notable Member

    Messages:
    4,642
    Likes Received:
    406
    Best Answers:
    21
    Trophy Points:
    295
    #3
    Thanks, so I am clear I take the sha1 encryption and make an md5 of that and then select md5 in phpmyadmin?

    Sorry, I get my question is a bit thick. Just trying to fix it and move on lol..

    Nigel
     
    Nigel Lew, Jan 6, 2011 IP
  4. mcfc4eva

    mcfc4eva Well-Known Member

    Messages:
    602
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    110
    #4
    Yes the final string will be MD5.
     
    mcfc4eva, Jan 6, 2011 IP
  5. Nigel Lew

    Nigel Lew Notable Member

    Messages:
    4,642
    Likes Received:
    406
    Best Answers:
    21
    Trophy Points:
    295
    #5
    Great thanks much for your time. Rep coming.

    Nigel

    EDIT. That worked perfectly thanks.
     
    Last edited: Jan 6, 2011
    Nigel Lew, Jan 6, 2011 IP
  6. mcfc4eva

    mcfc4eva Well-Known Member

    Messages:
    602
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    110
    #6
    No problem :)
     
    mcfc4eva, Jan 6, 2011 IP
    jeremyhowell likes this.
  7. ankit_frenz

    ankit_frenz Active Member

    Messages:
    1,111
    Likes Received:
    41
    Best Answers:
    0
    Trophy Points:
    63
    #7
    btw if you already used sha there is no need of using md5..sha 126 is strong encryption in itself :)
     
    ankit_frenz, Jan 6, 2011 IP