digestpp  0.01
Experimental C++11 header-only message digest library.
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>
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  */
30  {
31  auto& k12m14 = static_cast<hasher<T, mixin::k12m14_mixin>&>(*this);
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>
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
hasher< T, mixin::k12m14_mixin > & set_customization(const C *customization, size_t customization_len)
Set customization from raw buffer.
Definition: k12m14_mixin.hpp:45
hasher< detail::shake_provider< 256, 24 > > shake256
SHAKE256 function.
Definition: shake.hpp:53