This commit is contained in:
Green Sky 2024-01-13 22:54:38 +01:00
parent 9d3d81d4ff
commit 3df9125877
No known key found for this signature in database
4 changed files with 2 additions and 35 deletions

View File

@ -11,9 +11,6 @@ target_include_directories(solanaceae_toxcore_interface INTERFACE .)
target_compile_features(solanaceae_toxcore_interface INTERFACE cxx_std_17) target_compile_features(solanaceae_toxcore_interface INTERFACE cxx_std_17)
add_library(solanaceae_toxcore add_library(solanaceae_toxcore
./solanaceae/toxcore/utils.hpp
./solanaceae/toxcore/utils.cpp
./solanaceae/toxcore/tox_key.hpp ./solanaceae/toxcore/tox_key.hpp
./solanaceae/toxcore/tox_key.cpp ./solanaceae/toxcore/tox_key.cpp
@ -37,5 +34,6 @@ target_compile_features(solanaceae_toxcore PUBLIC cxx_std_17)
target_link_libraries(solanaceae_toxcore PUBLIC target_link_libraries(solanaceae_toxcore PUBLIC
toxcore toxcore
solanaceae_toxcore_interface solanaceae_toxcore_interface
solanaceae_util
) )

View File

@ -1,7 +1,7 @@
#include <tox/tox.h> // before interface #include <tox/tox.h> // before interface
#include "./tox_interface.hpp" #include "./tox_interface.hpp"
#include "./utils.hpp" #include <solanaceae/util/utils.hpp>
std::string ToxI_raw::toxSelfGetAddressStr(void) { std::string ToxI_raw::toxSelfGetAddressStr(void) {
// TODO: cache // TODO: cache

View File

@ -1,23 +0,0 @@
#include "./utils.hpp"
#include <sodium.h>
std::vector<uint8_t> hex2bin(const std::string& str) {
std::vector<uint8_t> bin{};
bin.resize(str.size()/2, 0);
sodium_hex2bin(bin.data(), bin.size(), str.c_str(), str.length(), nullptr, nullptr, nullptr);
return bin;
}
std::string bin2hex(const std::vector<uint8_t>& bin) {
std::string str{};
str.resize(bin.size()*2, '?');
// HECK, std is 1 larger than size returns ('\0')
sodium_bin2hex(str.data(), str.size()+1, bin.data(), bin.size());
return str;
}

View File

@ -1,8 +0,0 @@
#pragma once
#include <string>
#include <vector>
std::vector<uint8_t> hex2bin(const std::string& str);
std::string bin2hex(const std::vector<uint8_t>& bin);