[mysql+authme]password hash #45


  • New
  • Defect
Open
Assigned to _ForgeUser7462391
  • _ForgeUser8377675 created this issue Feb 5, 2012

    hi,
    i'm trying to make a registration page on the website of my server, sò i can control the number of account that can each person create...
    but i can't figure out how to encrypt the password taken from $_POST variable, in a way that authme can accept during login in game
    i read that authme use SHA256 algorithm, but my php code doesn't work

    $enc = "\$SHA$" .hash('sha256',$_POST['pwd1']);

    reading on forum i saw some people talking about a random string to generate, but how is that possible in PHP ?

    where am I doing wrong?

    advance thanks to anyone that could help me

    P.S sorry for my english, i'm italian ;)

  • _ForgeUser8377675 added the tags New Defect Feb 5, 2012
  • _ForgeUser10375701 posted a comment Feb 27, 2013

    No one know how to do that.... I was looking for that about 2 hours... thats incredible... Authme is working with our user passwords and dont say how to hash a password...

    I was looking a lot and they never say how to do it...

    String encryptedPassword = "$SHA$" + salt + "$" + sha256(sha256(password) + salt);

    You can look that but... what is our salt? We never configured a salt!, how we can do that without the default salt?

    If you read more and more you will see that the deafult salt is "salt" But this not mean that you need to put "salt noo"

    You need to do that:

    For example you have this password:

    $SHA$a1f9d6d409f03e2c$fe742523771dfaefa7c4e164720966442d54d3b887a9d953784d1cc5e234b447

    And you know (in this example) that this password is ->>> "ejemplo"

    Ok you need to separate for that ($) it like that:

    SHA a1f9d6d409f03e2c fe742523771dfaefa7c4e164720966442d54d3b887a9d953784d1cc5e234b447

    Ok the important now is a1f9d6d409f03e2c. This is the salt right??

    Then you can do all that you want like this (php):

    echo '$SHA$'.'a1f9d6d409f03e2c'.'$'.hash('sha256',hash('sha256', 'ejemplo').'a1f9d6d409f03e2c')

    Obvioubsly thats an example, you need to make a function for do that more good.

    )
  • _ForgeUser10375701 posted a comment Feb 27, 2013

To post a comment, please login or register a new account.