mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-11 07:10:36 +00:00
9e9c1ea732
Lots of code was using 32-byte nonces for xchacha20 symmetric encryption, but this just means 8 extra bytes per packet wasted as chacha is only using the first 24 bytes of that nonce anyway. Changing this resulted in a lot of dead/dying code breaking, so this commit also removes a lot of that (and comments a couple places with TODO instead) Also nounce -> nonce where it came up.
30 lines
803 B
C++
30 lines
803 B
C++
#include "abstracthophandler.hpp"
|
|
|
|
#include <llarp/router/router.hpp>
|
|
|
|
namespace llarp::path
|
|
{
|
|
std::string
|
|
make_onion_payload(
|
|
const SymmNonce& nonce, const PathID_t& path_id, const std::string_view& inner_payload)
|
|
{
|
|
return make_onion_payload(
|
|
nonce,
|
|
path_id,
|
|
ustring_view{
|
|
reinterpret_cast<const unsigned char*>(inner_payload.data()), inner_payload.size()});
|
|
}
|
|
|
|
std::string
|
|
make_onion_payload(
|
|
const SymmNonce& nonce, const PathID_t& path_id, const ustring_view& inner_payload)
|
|
{
|
|
oxenc::bt_dict_producer next_dict;
|
|
next_dict.append("NONCE", nonce.ToView());
|
|
next_dict.append("PATHID", path_id.ToView());
|
|
next_dict.append("PAYLOAD", inner_payload);
|
|
|
|
return std::move(next_dict).str();
|
|
}
|
|
} // namespace llarp::path
|