digestpp
0.01
Experimental C++11 header-only message digest library.
algorithm
mixin
k12m14_mixin.hpp
1
/*
2
This code is written by kerukuro and released into public domain.
3
*/
4
5
#
ifndef
DIGESTPP_MIXINS_K12M14_HPP
6
#
define
DIGESTPP_MIXINS_K12M14_HPP
7
8
namespace
digestpp
9
{
10
11
namespace
mixin
12
{
13
14
/**
15
* \brief Defines additional public functions for KangarooTwelve and MarsupilamiFourteen.
16
* \sa hasher, k12, m14
17
*/
18
template
<
typename
T>
19
class
k12m14_mixin
20
{
21
public
:
22
23
/**
24
* \brief Set customization from std::string
25
*
26
* \param[in] customization Customization string
27
* \return Reference to hasher
28
*/
29
inline
hasher
<
T
,
mixin
::
k12m14_mixin
>&
set_customization
(
const
std
::
string
&
customization
)
30
{
31
auto
&
k12m14
=
static_cast
<
hasher
<
T
,
mixin
::
k12m14_mixin
>&>(*
this
);
32
k12m14
.
provider
.
set_customization
(
customization
);
33
k12m14
.
provider
.
init
();
34
return
k12m14
;
35
}
36
37
/**
38
* \brief Set customization from raw buffer
39
*
40
* \param[in] customization Pointer to customization bytes
41
* \param[in] customization_len Customization length (in bytes)
42
* \return Reference to hasher
43
*/
44
template
<
typename
C
,
typename
std
::
enable_if
<
detail
::
is_byte
<
C
>::
value
>::
type
* =
nullptr
>
45
inline
hasher
<
T
,
mixin
::
k12m14_mixin
>&
set_customization
(
const
C
*
customization
,
size_t
customization_len
)
46
{
47
return
set_customization
(
std
::
string
(
reinterpret_cast
<
const
char
*>(
customization
),
customization_len
));
48
}
49
};
50
51
}
// namespace mixin
52
53
}
// namespace digestpp
54
55
#
endif
// DIGESTPP_MIXINS_K12M14_HPP
digestpp::mixin::k12m14_mixin::set_customization
hasher< T, mixin::k12m14_mixin > & set_customization(const C *customization, size_t customization_len)
Set customization from raw buffer.
Definition:
k12m14_mixin.hpp:45
digestpp::shake256
hasher< detail::shake_provider< 256, 24 > > shake256
SHAKE256 function.
Definition:
shake.hpp:53
Generated by
1.8.13