1#ifndef LIBFILEZILLA_HASH_HEADER
2#define LIBFILEZILLA_HASH_HEADER
24enum class hmac_algorithm
43 size_t digest_size()
const;
47 void update(std::string_view
const& data);
48 void update(std::basic_string_view<uint8_t>
const& data);
49 void update(std::vector<uint8_t>
const& data);
50 void update(uint8_t
const* data,
size_t size);
51 void update(
buffer const& data);
52 void update(uint8_t in) {
58 void digest(uint8_t* out,
size_t s);
60 operator std::vector<uint8_t>() {
64 bool is_digest(std::string_view
const& ref);
65 bool is_digest(uint8_t
const* ref,
size_t s);
69 update(std::forward<T>(in));
75 bool import_state(std::vector<std::uint8_t>
const& state);
86std::vector<uint8_t> FZ_PUBLIC_SYMBOL
md5(std::string_view
const& data);
87std::vector<uint8_t> FZ_PUBLIC_SYMBOL
md5(std::vector<uint8_t>
const& data);
90std::vector<uint8_t> FZ_PUBLIC_SYMBOL
sha256(std::string_view
const& data);
91std::vector<uint8_t> FZ_PUBLIC_SYMBOL
sha256(std::vector<uint8_t>
const& data);
97std::vector<uint8_t> FZ_PUBLIC_SYMBOL
hmac_sha1(std::string_view
const& key, std::string_view
const& data);
98std::vector<uint8_t> FZ_PUBLIC_SYMBOL
hmac_sha1(std::vector<uint8_t>
const& key, std::vector<uint8_t>
const& data);
99std::vector<uint8_t> FZ_PUBLIC_SYMBOL
hmac_sha1(std::vector<uint8_t>
const& key, std::string_view
const& data);
100std::vector<uint8_t> FZ_PUBLIC_SYMBOL
hmac_sha1(std::string_view
const& key, std::vector<uint8_t>
const& data);
103std::vector<uint8_t> FZ_PUBLIC_SYMBOL
hmac_sha256(std::string_view
const& key, std::string_view
const& data);
104std::vector<uint8_t> FZ_PUBLIC_SYMBOL
hmac_sha256(std::vector<uint8_t>
const& key, std::vector<uint8_t>
const& data);
105std::vector<uint8_t> FZ_PUBLIC_SYMBOL
hmac_sha256(std::vector<uint8_t>
const& key, std::string_view
const& data);
106std::vector<uint8_t> FZ_PUBLIC_SYMBOL
hmac_sha256(std::string_view
const& key, std::vector<uint8_t>
const& data);
108std::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);
110template <
typename PasswordContainer,
typename SaltContainer,
111 std::enable_if_t<
sizeof(
typename PasswordContainer::value_type) ==
sizeof(uint8_t) &&
112 sizeof(
typename SaltContainer::value_type) ==
sizeof(uint8_t)>* =
nullptr>
113std::vector<uint8_t> pbkdf2_hmac_sha256(PasswordContainer
const& password, SaltContainer
const& salt,
size_t length,
unsigned int iterations)
115 return pbkdf2_hmac_sha256(std::basic_string_view<uint8_t>(
reinterpret_cast<uint8_t const*
>(password.data()), password.size()),
116 std::basic_string_view<uint8_t>(
reinterpret_cast<uint8_t const*
>(salt.data()), salt.size()),
The buffer class is a simple buffer where data can be appended at the end and consumed at the front....
Definition buffer.hpp:27
Accumulator for hashing large amounts of data.
Definition hash.hpp:33
std::vector< std::uint8_t > export_state()
Currently only implemented for SHA1.
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 > md5(std::string_view const &data)
Standard MD5.
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 > hmac_sha256(std::string_view const &key, std::string_view const &data)
Standard HMAC using SHA256.