xref: /aosp_15_r20/external/cronet/net/base/hex_utils.cc (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2017 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 #include "net/base/hex_utils.h"
6 
7 #include "base/check.h"
8 #include "base/strings/string_number_conversions.h"
9 #include "net/third_party/quiche/src/quiche/common/quiche_text_utils.h"
10 
11 namespace net {
12 
HexDecode(std::string_view hex)13 std::string HexDecode(std::string_view hex) {
14   std::string output;
15   const bool success = base::HexStringToString(hex, &output);
16   DCHECK(success);
17   return output;
18 }
19 
HexDump(std::string_view input)20 std::string HexDump(std::string_view input) {
21   return quiche::QuicheTextUtils::HexDump(input);
22 }
23 
24 }  // namespace net
25