1 // Copyright 2023 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef BSSL_FILLINS_STRING_UTIL_H 6 #define BSSL_FILLINS_STRING_UTIL_H 7 8 #include <openssl/base.h> 9 10 #include <string.h> 11 #include <cassert> 12 #include <string> 13 #include <string_view> 14 15 namespace bssl { 16 17 namespace fillins { 18 19 OPENSSL_EXPORT std::string HexEncode(const void *bytes, size_t size); 20 21 OPENSSL_EXPORT std::string CollapseWhitespaceASCII( 22 std::string_view text, bool trim_sequences_with_line_breaks); 23 24 OPENSSL_EXPORT bool EqualsCaseInsensitiveASCII(std::string_view a, 25 std::string_view b); 26 27 OPENSSL_EXPORT bool IsAsciiAlpha(char c); 28 29 OPENSSL_EXPORT bool IsAsciiDigit(char c); 30 31 OPENSSL_EXPORT void ReplaceSubstringsAfterOffset(std::string *s, size_t offset, 32 std::string_view find, 33 std::string_view replace); 34 35 OPENSSL_EXPORT std::string HexDecode(std::string_view hex); 36 37 } // namespace fillins 38 39 } // namespace bssl 40 41 #endif // BSSL_FILLINS_STRING_UTIL_H 42