SEGS  0.4.2
Super Entity Game Server
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 - 2018 SEGS Team (see Authors.txt)
5  * This software is licensed! (See License.txt 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 };
QString getRandomString(int length) const
Definition: PasswordHasher.cpp:22
Definition: PasswordHasher.h:14
PasswordHasher()
Definition: PasswordHasher.cpp:17
QByteArray hashPassword(const QByteArray &pass, const QByteArray &salt)
Hashes a password with the given salt using the Sha256 algorithm.
Definition: PasswordHasher.cpp:54
QCryptographicHash m_hasher
Definition: PasswordHasher.h:24
QByteArray generateSalt()
Generates a random salt of length 16.
Definition: PasswordHasher.cpp:42