[DiscordArchive] but are you generating salt and verifier correctly?
[DiscordArchive] but are you generating salt and verifier correctly?
Archived author: Tea • Posted: 2024-01-02T15:58:15.018000+00:00
Original source
but are you generating salt and verifier correctly?
Archived author: ZaDarkSide • Posted: 2024-01-02T15:58:17.602000+00:00
Original source
the PHP code is fine, just needs not to use the deleted column anymore
Archived author: Tea • Posted: 2024-01-02T15:58:52.674000+00:00
Original source
you must use SHA256(email) (hex string) as username in srp, not email directly
Archived author: ZaDarkSide • Posted: 2024-01-02T16:00:56.840000+00:00
Original source
```PHP
function Encrypt($email, $password)
{
if (!is_string($email)) {
$email = '';
}
if (!is_string($password)) {
$password = '';
}
return strtoupper(bin2hex(strrev(hex2bin(strtoupper(hash("sha256", strtoupper(hash("sha256", strtoupper($email)) . ":" . strtoupper($password))))))));
}
```
Archived author: ZaDarkSide • Posted: 2024-01-02T16:01:08.087000+00:00
Original source
that's the PHP way to do what Shauren said
Archived author: Tea • Posted: 2024-01-02T16:01:24.934000+00:00
Original source
thats the old sha_pass_hash, right?
Archived author: ZaDarkSide • Posted: 2024-01-02T16:01:59.204000+00:00
Original source
yeah `$sha_pass_hash = Encrypt($email, $password);`
Archived author: ZaDarkSide • Posted: 2024-01-02T16:03:11.967000+00:00
Original source
```PHP
function CalculateSRP6Verifier($username, $password, $salt)
{
// algorithm constants
$g = gmp_init(7);
$N = gmp_init('894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7', 16);
// calculate first then calculate the second hash; at last convert to integer (little-endian)
$h = gmp_import(sha1($salt . sha1(strtoupper($username . ':' . $password), true), true), 1, GMP_LSW_FIRST);
// convert back to byte array, within a 32 pad; remember zeros go on the end in little-endian
return str_pad(gmp_export(gmp_powm($g, $h, $N), 1, GMP_LSW_FIRST), 32, chr(0), STR_PAD_RIGHT);
}
// Returns SRP6 parameters to register this username/password combination with
function GetSRP6RegistrationData($username, $password)
{
// generate a random salt
/** @noinspection PhpUnhandledExceptionInspection */
$salt = random_bytes(32);
// calculate verifier using this salt
$verifier = CalculateSRP6Verifier($username, $password, $salt);
// done - this is what you put in the account table!
return array($salt, $verifier);
}
```
Archived author: ZaDarkSide • Posted: 2024-01-02T16:03:23.371000+00:00
Original source
this is salt + verifier way
Archived author: Tea • Posted: 2024-01-02T16:03:34.450000+00:00
Original source
thats the old wotlk srp