aboutsummaryrefslogtreecommitdiff
path: root/node/node_node.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'node/node_node.cpp')
-rw-r--r--node/node_node.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/node/node_node.cpp b/node/node_node.cpp
index 63a44df..7990a12 100644
--- a/node/node_node.cpp
+++ b/node/node_node.cpp
@@ -126,31 +126,31 @@ cmix_proto::RealPre fill_realtime_pre_message(CMixContext& ctx, T const& hs, T c
cmix_proto::RealPre realpre;
size_t len = get_group_element_array_size(&ctx);
+
+ std::vector<char*> msv1(ms.size(), nullptr);
+ std::vector<char const*> msv2(ms.size(), nullptr);
+ std::vector<GroupElement> gs(ms.size(), nullptr);
+
for(int i = 0; i < ms.size(); ++i) {
- realpre.add_h();
- realpre.add_m();
- realpre.mutable_m(i)->resize(len);
+ std::string* m = realpre.add_m();
+ m->resize(len);
+ msv1[i] = &(*m)[0];
- std::string x = to_string(data.at(hs.Get(i)).shared_value, ctx);
- {
- std::stringstream ss;
- ss << "shared_key: ";
- for(auto&& c : x) {
- ss << "\\" << std::setw(3) << std::setfill('0') << std::oct << (unsigned int) c;
- }
- BOOST_LOG_TRIVIAL(trace) << ss.str();
- }
+ msv2[i] = ms.Get(i).data();
+
+ realpre.add_h(hs.Get(i));
- swap_k_for_r(
- &ctx,
- &(*realpre.mutable_m(i))[0],
- ms.Get(i).data(),
- data.at(hs.Get(i)).shared_value,
- i
- );
- *realpre.mutable_h(i) = hs.Get(i);
+ gs[i] = data.at(hs.Get(i)).shared_value;
}
+ swap_k_for_r(
+ &ctx,
+ msv1.data(),
+ msv2.data(),
+ gs.data(),
+ ms.size()
+ );
+
return realpre;
}