Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
hex_codec.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
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 "flutter/fml/base32.h"
6
7#include <cstdint> // uint8_t
8#include <string>
9
10namespace fml {
11
12static constexpr char kEncoding[] = "0123456789abcdef";
13
14std::string HexEncode(std::string_view input) {
15 std::string result;
16 result.reserve(input.size() * 2);
17 for (char c : input) {
18 uint8_t b = static_cast<uint8_t>(c);
19 result.push_back(kEncoding[b >> 4]);
20 result.push_back(kEncoding[b & 0xF]);
21 }
22 return result;
23}
24
25} // namespace fml
static bool b
GAsyncResult * result
std::string HexEncode(std::string_view input)
Definition hex_codec.cc:14
static constexpr char kEncoding[]
Definition base32.cc:13