digestpp 1.0
C++11 header-only message digest library
Loading...
Searching...
No Matches
blake_mixin.hpp
Go to the documentation of this file.
1/*
2This code is written by kerukuro and released into public domain.
3*/
4
5#ifndef DIGESTPP_MIXINS_BLAKE_HPP
6#define DIGESTPP_MIXINS_BLAKE_HPP
7
8namespace digestpp
9{
10
11namespace mixin
12{
13
18template<typename T>
20{
21public:
22
32 inline hasher<T, mixin::blake_mixin>& set_salt(const std::string& salt)
33 {
34 return set_salt(salt.c_str(), salt.size());
35 }
36
47 template<typename C, typename std::enable_if<detail::is_byte<C>::value>::type* = nullptr>
48 inline hasher<T, mixin::blake_mixin>& set_salt(const C* salt, size_t salt_len)
49 {
50 auto& blake = static_cast<hasher<T, mixin::blake_mixin>&>(*this);
51 blake.provider.set_salt(reinterpret_cast<const unsigned char*>(salt), salt_len);
52 blake.provider.init();
53 return blake;
54 }
55};
56
57} // namespace mixin
58
59} // namespace digestpp
60
61#endif
Main class template implementing the public API for hashing.
Definition hasher.hpp:38
Defines additional public functions for BLAKE algorithm.
Definition blake_mixin.hpp:20
hasher< T, mixin::blake_mixin > & set_salt(const std::string &salt)
Set salt from std::string.
Definition blake_mixin.hpp:32
hasher< T, mixin::blake_mixin > & set_salt(const C *salt, size_t salt_len)
Set salt from raw buffer.
Definition blake_mixin.hpp:48
hasher< detail::blake_provider<>, mixin::blake_mixin > blake
BLAKE hash function (SHA-3 finalist)
Definition blake.hpp:58
digestpp namespace
Definition ascon.hpp:14