-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathpassword_hashing_argon2.cpp
50 lines (40 loc) · 1.16 KB
/
password_hashing_argon2.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//
// Created by Ivan Shynkarenka on 05.06.2019
//
#include "benchmark/cppbenchmark.h"
#include "security/password_hashing_argon2.h"
using namespace CppSecurity;
BENCHMARK("'Argon2d' generate")
{
static Argon2dPasswordHashing scrypt;
std::string digest = scrypt.GenerateDigest("passw0rd");
}
BENCHMARK("'Argon2d' validate")
{
static Argon2dPasswordHashing scrypt;
static std::string digest = scrypt.GenerateDigest("passw0rd");
scrypt.ValidateDigest("passw0rd", digest);
}
BENCHMARK("'Argon2i' generate")
{
static Argon2iPasswordHashing scrypt;
std::string digest = scrypt.GenerateDigest("passw0rd");
}
BENCHMARK("'Argon2i' validate")
{
static Argon2iPasswordHashing scrypt;
static std::string digest = scrypt.GenerateDigest("passw0rd");
scrypt.ValidateDigest("passw0rd", digest);
}
BENCHMARK("'Argon2id' generate")
{
static Argon2idPasswordHashing scrypt;
std::string digest = scrypt.GenerateDigest("passw0rd");
}
BENCHMARK("'Argon2id' validate")
{
static Argon2idPasswordHashing scrypt;
static std::string digest = scrypt.GenerateDigest("passw0rd");
scrypt.ValidateDigest("passw0rd", digest);
}
BENCHMARK_MAIN()