Skip to content

Conversation

@cacharle
Copy link
Contributor

@cacharle cacharle commented Dec 9, 2025

Fixes #670

@cacharle cacharle marked this pull request as draft December 9, 2025 17:50
@cacharle cacharle marked this pull request as ready for review December 9, 2025 18:17
@cacharle
Copy link
Contributor Author

cacharle commented Dec 9, 2025

Not sure why the CI is failing

return public_key_buffer;
}

namespace z85 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

z85 is not necessarily only used for curve, so I think I would prefer zmq::z85_endcode/z85_decode.


namespace curve {

inline std::pair<std::string, std::string> keypair()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The style of the library would be to name these zmq::curve_keypair and zmq::curve_public.

char *buffer = new char[buffer_size];
auto *result = zmq_z85_encode(buffer, data.data(), data.size());
if (result == nullptr)
throw zmq::error_t();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This leaks memory.

Could do std::string dest(buffer_size - 1); and write to that directly.


inline std::vector<uint8_t> decode(const std::string& encoded)
{
size_t dest_size = static_cast<double>(encoded.size()) * 0.8;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a bit afraid of these floating point computations here and in encode.
What about (encoded.size() * size_t{4}) / size_t{5}?

@gummif
Copy link
Member

gummif commented Dec 10, 2025

Could you try bumping the C++ version of the gcc-9 test to gcc-11?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add curve functions wrappers

2 participants