mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Almost completed registration
* added missing bits of serverside code; * added fronted in client; * removed demo python scripts;
This commit is contained in:
parent
735fcbf311
commit
5ace0dd892
20 changed files with 585 additions and 112 deletions
|
|
@ -8,6 +8,8 @@
|
|||
#include <QCryptographicHash>
|
||||
#endif
|
||||
|
||||
#include "rng_sfmt.h"
|
||||
|
||||
void PasswordHasher::initialize()
|
||||
{
|
||||
#if QT_VERSION < 0x050000
|
||||
|
|
@ -51,3 +53,20 @@ QString PasswordHasher::computeHash(const QString &password, const QString &salt
|
|||
return hashedPass;
|
||||
}
|
||||
#endif
|
||||
|
||||
QString PasswordHasher::generateRandomSalt(const int len)
|
||||
{
|
||||
static const char alphanum[] =
|
||||
"0123456789"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
"abcdefghijklmnopqrstuvwxyz";
|
||||
|
||||
QString ret;
|
||||
int size = sizeof(alphanum) - 1;
|
||||
|
||||
for (int i = 0; i < len; ++i) {
|
||||
ret.append(alphanum[rng->rand(0, size)]);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue