Skip to content

UUID basic_random_generator behavior change during 1.86 release #174

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
corpoverlords opened this issue Mar 13, 2025 · 0 comments
Open

Comments

@corpoverlords
Copy link

Hello,

The following code:

#include <boost/beast/core/detail/base64.hpp>
#include <boost/uuid/random_generator.hpp>
#include <iostream>
#include <random>

// Type your code here, or load an example.
int main() {
    std::mt19937_64 rng(0);

    boost::uuids::basic_random_generator<std::mt19937_64> uuid_gen{rng};

    auto generated = uuid_gen();
    auto enc_max = boost::beast::detail::base64::encoded_size(16);
    std::string encoded(" ", enc_max);
    auto buffer = std::string(generated.begin(), generated.end());
    boost::beast::detail::base64::encode(
        (void*)encoded.c_str(), (const void*)buffer.c_str(), buffer.size());
    std::cout << encoded << "\n";
}

Generated

PtxBy8U3SCiL+UA+fDr9/Q==

for Boost < 1.86

But after 1.86 it generated

xTfoKHw6Tf2XMiEKA2n1mA==

which is not listed in the changelog. Is there a way to restore the original behavior?

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

No branches or pull requests

1 participant