/*
 * Copyright (C) 2021 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#pragma once

#include <string>
#include <vector>

#include <stdint.h>

namespace android {
namespace base {

// Converts binary data into a hexString.
//
// Hex values are printed in order, e.g. 0xDEAD will result in 'adde' because
// Android is little-endian.
std::string HexString(const void* bytes, size_t len);

// Converts hexString to binary data.
//
// hex: Input hexString
// bytes: Output binary data
//
// Returns true on success, false on failure
bool HexToBytes(const std::string& hex, std::vector<uint8_t>* bytes);

}  // namespace base
}  // namespace android
