Hello,  I discovered this bug by accident
https://svn.boost.org/trac/boost/changeset/68866
which was only linked via the ticket mentioned below,

The code below demonstrates that ANY wide-character string of the same length resolves to the same UUID !

Thats pretty darn serious, I expected to see a much more serious mention in the Changelog in boost 1.47.0... for UUID, there was only a mention of a few tickets
including this one:
 https://svn.boost.org/trac/boost/ticket/5145
which only mentioned a WARNING in the description !
"Fixed warning: use of logical && with constant operand; switch to bitwise & or remove constant [-Wconstant-logical-operand]"

Surely it should say something like "UUIDs for wide character strings are totally wrong"

Note also that the Changelog link for UUID goes to Utility, not UUID.


The code:


#include <boost/uuid/name_generator.hpp>
#include <boost/uuid/nil_generator.hpp>
#include <boost/uuid/uuid_io.hpp>
#include <iostream>

using namespace boost::uuids;
using namespace std;

int main()
{
   {
      cout << "WIDE" << endl;
      const wchar_t* a = L"one long string that is something like this and that blahh";
      const wchar_t* b = L"hello there you long long string that looks nothing like t";

      nil_generator nil;
      name_generator na(nil());
      name_generator nb(nil());

      uuid ua = na(a);
      uuid ub = nb(b);

      cout << to_string(ua) << endl;
      cout << to_string(ub) << endl;
   }

   {
      cout << "NARROW" << endl;
      const char* a = "one long string that is something like this and that blahh";
      const char* b = "hello there you long long string that looks nothing like t";

      nil_generator nil;
      name_generator na(nil());
      name_generator nb(nil());

      uuid ua = na(a);
      uuid ub = nb(b);

      cout << to_string(ua) << endl;
      cout << to_string(ub) << endl;
   }

   return 0;
}



the result:

$ g++ main.cpp && ./a.out 
WIDE
4ffa48af-9685-5089-97ac-fe6627ead94c
4ffa48af-9685-5089-97ac-fe6627ead94c
NARROW
73030b72-a864-5c7b-9963-c0bedff1283e
da8943a6-26c9-5641-bd37-427b1b70d619
$


The two different wchar_t strings resolve to the same uuid !!!

What am I doing wrong?

thanks
Paul