10Duke Enterprise C++ SDK
Toggle main menu visibility
Loading...
Searching...
No Matches
HashAlgorithm.h
1
#ifndef TENDUKE_CRYPTO_HASHALGORITHM_H
2
#define TENDUKE_CRYPTO_HASHALGORITHM_H
3
4
#include <cstdint>
5
#include <string>
6
7
namespace
tenduke
{
namespace
crypto
{
8
12
enum class
HashAlgorithm
: std::int16_t
13
{
14
UNKNOWN = -1,
15
NONE = 0,
16
SHA256 = 1
17
};
18
20
constexpr
std::size_t
SHA256_HASH_LENGTH_BYTES
= 32;
21
27
inline
HashAlgorithm
toHashAlgorithm
(
const
std::string &algorithm)
28
{
29
if
(algorithm ==
"SHA256"
) {
30
return
HashAlgorithm::SHA256;
31
}
32
if
(algorithm ==
"NONE"
) {
33
return
HashAlgorithm::NONE;
34
}
35
return
HashAlgorithm::UNKNOWN;
36
}
37
43
inline
const
char
*
toString
(
const
HashAlgorithm
algorithm)
44
{
45
switch
(algorithm) {
46
case
HashAlgorithm::SHA256:
47
return
"SHA256"
;
48
case
HashAlgorithm::NONE:
49
return
"NONE"
;
50
default
:
51
return
"UNKNOWN"
;
52
}
53
}
54
55
}}
56
57
#endif
//TENDUKE_CRYPTO_HASHALGORITHM_H
tenduke::crypto
Cryptography services.
Definition
AbstractCiphers.h:18
tenduke::crypto::SHA256_HASH_LENGTH_BYTES
constexpr std::size_t SHA256_HASH_LENGTH_BYTES
Length of SHA256 hash binary representation in bytes.
Definition
HashAlgorithm.h:20
tenduke::crypto::HashAlgorithm
HashAlgorithm
Currently supported hash algorithms.
Definition
HashAlgorithm.h:13
tenduke::crypto::toString
const char * toString(const HashAlgorithm algorithm)
Converts HashAlgorithm enum to string representation.
Definition
HashAlgorithm.h:43
tenduke::crypto::toHashAlgorithm
HashAlgorithm toHashAlgorithm(const std::string &algorithm)
Converts string representation to HashAlgorithm enum.
Definition
HashAlgorithm.h:27
tenduke
Root for classes, functions and globals of 10Duke C++ Client.
Definition
APIRequest.h:4
core
core
src
crypto
msgauthn
HashAlgorithm.h
Generated by
1.17.0