TrinityCore
Loading...
Searching...
No Matches
Argon2Hash.h
Go to the documentation of this file.
1
/*
2
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3
*
4
* This program is free software; you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License as published by the
6
* Free Software Foundation; either version 2 of the License, or (at your
7
* option) any later version.
8
*
9
* This program is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12
* more details.
13
*
14
* You should have received a copy of the GNU General Public License along
15
* with this program. If not, see <http://www.gnu.org/licenses/>.
16
*/
17
18
#ifndef TRINITY_ARGON2_H
19
#define TRINITY_ARGON2_H
20
21
#include "
BigNumber.h
"
22
#include "
Define.h
"
23
#include "
Optional.h
"
24
#include <string>
25
26
namespace
Trinity::Crypto
27
{
28
struct
TC_COMMON_API
Argon2
29
{
30
static
constexpr
uint32
HASH_LEN = 16;
// 128 bits, in bytes
31
static
constexpr
uint32
ENCODED_HASH_LEN = 100;
// in chars
32
static
constexpr
uint32
DEFAULT_ITERATIONS = 10;
// determined by dice roll, guaranteed to be secure (not really)
33
static
constexpr
uint32
DEFAULT_MEMORY_COST = (1u << 17);
// 2^17 kibibytes is 2^7 mebibytes is ~100MB
34
static
constexpr
uint32
PARALLELISM = 1;
// we don't support threaded hashing
35
36
static
Optional<std::string>
Hash(std::string
const
& password,
BigNumber
const
& salt,
uint32
nIterations = DEFAULT_ITERATIONS,
uint32
kibMemoryCost = DEFAULT_MEMORY_COST);
37
static
bool
Verify(std::string
const
& password, std::string
const
& hash);
38
};
39
}
40
41
#endif
BigNumber.h
Define.h
TC_COMMON_API
#define TC_COMMON_API
Definition
Define.h:99
uint32
uint32_t uint32
Definition
Define.h:154
Optional.h
Optional
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition
Optional.h:25
BigNumber
Definition
BigNumber.h:35
Trinity::Crypto
Definition
AES.h:27
Trinity::Crypto::Argon2
Definition
Argon2Hash.h:29
common
Cryptography
Argon2Hash.h
Generated on Sun May 10 2026 02:08:51 for TrinityCore by
1.9.8