updated build system
This commit is contained in:
@ -56,7 +56,7 @@ decrypt_data(const key_type &key, const unsigned char *buffer,
|
||||
res.resize(buffer_size - encryption_header_size);
|
||||
return crypto_aead_xchacha20poly1305_ietf_decrypt_detached(
|
||||
reinterpret_cast<unsigned char *>(res.data()), nullptr,
|
||||
&buffer[header_size], res.size(),
|
||||
&buffer[encryption_header_size], res.size(),
|
||||
&buffer[crypto_aead_xchacha20poly1305_IETF_NPUBBYTES],
|
||||
reinterpret_cast<const unsigned char *>(&size), sizeof(size),
|
||||
buffer, key.data()) == 0;
|
||||
|
37
support/3rd_party/include/utils/string.hpp
vendored
37
support/3rd_party/include/utils/string.hpp
vendored
@ -86,12 +86,6 @@ inline auto replace(string_t &src,
|
||||
std::basic_string_view<typename string_t::value_type> with,
|
||||
std::size_t start_pos = 0U) -> string_t &;
|
||||
|
||||
template <typename t>
|
||||
[[nodiscard]] auto from_hex_string(const std::string &str, t &val) -> bool;
|
||||
|
||||
template <typename collection_t>
|
||||
[[nodiscard]] auto to_hex_string(const collection_t &collection) -> std::string;
|
||||
|
||||
template <typename string_t>
|
||||
[[nodiscard]] inline auto replace_copy(string_t src,
|
||||
typename string_t::value_type character,
|
||||
@ -460,37 +454,6 @@ inline auto split(std::wstring_view str, std::wstring_view delim,
|
||||
bool should_trim) -> std::vector<std::wstring> {
|
||||
return split_t<std::wstring>(str, delim, should_trim);
|
||||
}
|
||||
|
||||
template <typename t>
|
||||
auto from_hex_string(const std::string &str, t &val) -> bool {
|
||||
static constexpr const auto base16 = 16;
|
||||
|
||||
val.clear();
|
||||
if (not(str.length() % 2U)) {
|
||||
for (std::size_t i = 0U; i < str.length(); i += 2U) {
|
||||
val.emplace_back(static_cast<typename t::value_type>(
|
||||
strtol(str.substr(i, 2U).c_str(), nullptr, base16)));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename collection_t>
|
||||
auto to_hex_string(const collection_t &collection) -> std::string {
|
||||
static_assert(sizeof(typename collection_t::value_type) == 1U,
|
||||
"value_type must be 1 byte in size");
|
||||
static constexpr const auto mask = 0xFF;
|
||||
|
||||
std::stringstream stream;
|
||||
for (auto &&val : collection) {
|
||||
stream << std::setfill('0') << std::setw(2) << std::hex
|
||||
<< (static_cast<std::uint32_t>(val) & mask);
|
||||
}
|
||||
|
||||
return stream.str();
|
||||
}
|
||||
} // namespace repertory::utils::string
|
||||
|
||||
#endif // REPERTORY_INCLUDE_UTILS_STRING_HPP_
|
||||
|
Reference in New Issue
Block a user