1 #ifndef LIBFILEZILLA_HASH_HEADER
2 #define LIBFILEZILLA_HASH_HEADER
37 void update(std::string_view
const& data);
38 void update(std::basic_string_view<uint8_t>
const& data);
39 void update(std::vector<uint8_t>
const& data);
40 void update(uint8_t
const* data,
size_t size);
41 void update(uint8_t in) {
48 operator std::vector<uint8_t>() {
54 update(std::forward<T>(in));
67 std::vector<uint8_t> FZ_PUBLIC_SYMBOL
md5(std::string_view
const& data);
68 std::vector<uint8_t> FZ_PUBLIC_SYMBOL
md5(std::vector<uint8_t>
const& data);
71 std::vector<uint8_t> FZ_PUBLIC_SYMBOL
sha256(std::string_view
const& data);
72 std::vector<uint8_t> FZ_PUBLIC_SYMBOL
sha256(std::vector<uint8_t>
const& data);
78 std::vector<uint8_t> FZ_PUBLIC_SYMBOL
hmac_sha1(std::string_view
const& key, std::string_view
const& data);
79 std::vector<uint8_t> FZ_PUBLIC_SYMBOL
hmac_sha1(std::vector<uint8_t>
const& key, std::vector<uint8_t>
const& data);
80 std::vector<uint8_t> FZ_PUBLIC_SYMBOL
hmac_sha1(std::vector<uint8_t>
const& key, std::string_view
const& data);
81 std::vector<uint8_t> FZ_PUBLIC_SYMBOL
hmac_sha1(std::string_view
const& key, std::vector<uint8_t>
const& data);
84 std::vector<uint8_t> FZ_PUBLIC_SYMBOL
hmac_sha256(std::string_view
const& key, std::string_view
const& data);
85 std::vector<uint8_t> FZ_PUBLIC_SYMBOL
hmac_sha256(std::vector<uint8_t>
const& key, std::vector<uint8_t>
const& data);
86 std::vector<uint8_t> FZ_PUBLIC_SYMBOL
hmac_sha256(std::vector<uint8_t>
const& key, std::string_view
const& data);
87 std::vector<uint8_t> FZ_PUBLIC_SYMBOL
hmac_sha256(std::string_view
const& key, std::vector<uint8_t>
const& data);
89 std::vector<uint8_t> FZ_PUBLIC_SYMBOL pbkdf2_hmac_sha256(std::basic_string_view<uint8_t>
const& password, std::basic_string_view<uint8_t>
const& salt,
size_t length,
unsigned int iterations);
91 template <
typename PasswordContainer,
typename SaltContainer,
92 std::enable_if_t<
sizeof(
typename PasswordContainer::value_type) ==
sizeof(uint8_t) &&
93 sizeof(
typename SaltContainer::value_type) ==
sizeof(uint8_t)>* =
nullptr>
94 std::vector<uint8_t> pbkdf2_hmac_sha256(PasswordContainer
const& password, SaltContainer
const& salt,
size_t length,
unsigned int iterations)
96 return pbkdf2_hmac_sha256(std::basic_string_view<uint8_t>(
reinterpret_cast<uint8_t const*
>(password.data()), password.size()),
97 std::basic_string_view<uint8_t>(
reinterpret_cast<uint8_t const*
>(salt.data()), salt.size()),
Accumulator for hashing large amounts of data.
Definition: hash.hpp:26
std::vector< uint8_t > digest()
Returns the raw digest and reinitializes the accumulator.
hash_accumulator(hash_algorithm algorithm)
Creates an initialized accumulator for the passed algorithm.
Sets some global macros and further includes string.hpp.
The namespace used by libfilezilla.
Definition: apply.hpp:17
hash_algorithm
List of supported hashing algorithms.
Definition: hash.hpp:17
std::vector< uint8_t > hmac_sha256(std::string_view const &key, std::string_view const &data)
Standard HMAC using SHA256.
std::vector< uint8_t > hmac_sha1(std::string_view const &key, std::string_view const &data)
Standard HMAC using SHA1.
std::vector< uint8_t > sha256(std::string_view const &data)
Standard SHA256.
std::vector< uint8_t > md5(std::string_view const &data)
Standard MD5.