Shaka Packager SDK
Loading...
Searching...
No Matches
hex_parser.h
1// Copyright 2022 Google LLC. All rights reserved.
2//
3// Use of this source code is governed by a BSD-style
4// license that can be found in the LICENSE file or at
5// https://developers.google.com/open-source/licenses/bsd
6
7#ifndef PACKAGER_UTILS_HEX_PARSER_H_
8#define PACKAGER_UTILS_HEX_PARSER_H_
9
10#include <cstdint>
11#include <string>
12#include <vector>
13
14namespace shaka {
15
16void HexStringToBytes(const std::string& hex, std::vector<uint8_t>* bytes);
17
18// If you use absl::HexStringToBytes directly, any invalid byte sequence will
19// be converted into NUL characters silently. This function will validate the
20// input.
21bool ValidHexStringToBytes(const std::string& hex, std::string* bytes);
22
23// same but output to a vector of uint8_t
24bool ValidHexStringToBytes(const std::string& hex, std::vector<uint8_t>* bytes);
25
26} // namespace shaka
27#endif // PACKAGER_UTILS_HEX_PARSER_H_
All the methods that are virtual are virtual for mocking.