SEGS  0.6.1-develop [d2cac982]
Super Entity Game Server
PasswordHasher.h
Go to the documentation of this file.
1 /*
2  * SEGS - Super Entity Game Server
3  * http://www.segs.io/
4  * Copyright (c) 2006 - 2019 SEGS Team (see AUTHORS.md)
5  * This software is licensed under the terms of the 3-clause BSD License. See LICENSE.md for details.
6  */
7 
8 #pragma once
9 
10 #include <QtCore/QString>
11 #include <QtCore/QStringList>
12 #include <QtCore/QCryptographicHash>
13 
15 {
16 public:
18  QByteArray generateSalt();
19  QByteArray hashPassword(const QByteArray &pass, const QByteArray &salt);
20 
21 protected:
22  QString getRandomString(int length) const;
23 
24  QCryptographicHash m_hasher;
25 };
QByteArray hashPassword(const QByteArray &pass, const QByteArray &salt)
Hashes a password with the given salt using the Sha256 algorithm.
Definition: PasswordHasher.cpp:53
Definition: PasswordHasher.h:14
QString getRandomString(int length) const
Definition: PasswordHasher.cpp:21
QByteArray generateSalt()
Generates a random salt of length 16.
Definition: PasswordHasher.cpp:41
QCryptographicHash m_hasher
Definition: PasswordHasher.h:24
PasswordHasher()
Definition: PasswordHasher.cpp:16