From 3df91258770ddaf12e8b4c6116890422d77438c1 Mon Sep 17 00:00:00 2001 From: Green Sky Date: Sat, 13 Jan 2024 22:54:38 +0100 Subject: [PATCH] move hex --- CMakeLists.txt | 4 +--- solanaceae/toxcore/tox_interface.cpp | 2 +- solanaceae/toxcore/utils.cpp | 23 ----------------------- solanaceae/toxcore/utils.hpp | 8 -------- 4 files changed, 2 insertions(+), 35 deletions(-) delete mode 100644 solanaceae/toxcore/utils.cpp delete mode 100644 solanaceae/toxcore/utils.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c695a3..a414b32 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,9 +11,6 @@ target_include_directories(solanaceae_toxcore_interface INTERFACE .) target_compile_features(solanaceae_toxcore_interface INTERFACE cxx_std_17) add_library(solanaceae_toxcore - ./solanaceae/toxcore/utils.hpp - ./solanaceae/toxcore/utils.cpp - ./solanaceae/toxcore/tox_key.hpp ./solanaceae/toxcore/tox_key.cpp @@ -37,5 +34,6 @@ target_compile_features(solanaceae_toxcore PUBLIC cxx_std_17) target_link_libraries(solanaceae_toxcore PUBLIC toxcore solanaceae_toxcore_interface + solanaceae_util ) diff --git a/solanaceae/toxcore/tox_interface.cpp b/solanaceae/toxcore/tox_interface.cpp index 0951b95..8c9950a 100644 --- a/solanaceae/toxcore/tox_interface.cpp +++ b/solanaceae/toxcore/tox_interface.cpp @@ -1,7 +1,7 @@ #include // before interface #include "./tox_interface.hpp" -#include "./utils.hpp" +#include std::string ToxI_raw::toxSelfGetAddressStr(void) { // TODO: cache diff --git a/solanaceae/toxcore/utils.cpp b/solanaceae/toxcore/utils.cpp deleted file mode 100644 index 4aac2d0..0000000 --- a/solanaceae/toxcore/utils.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include "./utils.hpp" - -#include - -std::vector hex2bin(const std::string& str) { - std::vector 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& 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; -} - diff --git a/solanaceae/toxcore/utils.hpp b/solanaceae/toxcore/utils.hpp deleted file mode 100644 index 21e62cd..0000000 --- a/solanaceae/toxcore/utils.hpp +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once - -#include -#include - -std::vector hex2bin(const std::string& str); -std::string bin2hex(const std::vector& bin); -