SA-MP Forums Archive
Password hash question - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Password hash question (/showthread.php?tid=649709)



Password hash question - BalkanEliteRP - 13.02.2018

Hi guys

I use now udb_hash function for password security
Код:
stock udb_hash(buf[]) //HASH PASS
{
    new length=strlen(buf);
    new s1 = 1;
    new s2 = 0;
    new n;
    for (n=0; n<length; n++)
    {
       s1 = (s1 + buf[n]) % 65521;
       s2 = (s2 + s1)     % 65521;
    }
    return (s2 << 16) + s1;
}
Is there any way to convert all this passwords to SHA256_PassHash ( https://sampwiki.blast.hk/wiki/SHA256_PassHash ) .Because i want to use

(I use MySQL)


Re: Password hash question - Virtual1ty - 13.02.2018

Require the user to input their password again, udb_hash it and compare it with old pass, then if it matches, hash the password with SHA-256 and store it. Hashes are always 1-way and cannot be reversed.


Re: Password hash question - Mugala - 13.02.2018

SHA256_PassHash <-- this is a function which is added in SA:MP 0.3.7 R1 (located in a_samp.inc)
so u can use SHA256_PassHash directly instead of udb_hash


Re: Password hash question - BalkanEliteRP - 13.02.2018

Quote:
Originally Posted by Virtual1ty
Посмотреть сообщение
Require the user to input their password again, udb_hash it and compare it with old pass, then if it matches, hash the password with SHA-256 and store it. Hashes are always 1-way and cannot be reversed.
Thank you for help.I'm aslo think about it but I hoped there have way maybe )