pcl icon indicating copy to clipboard operation
pcl copied to clipboard

Fix boost hash data type

Open OgreTransporter opened this issue 1 year ago • 2 comments

The boost data type should be used for boost::uuids::detail::sha1 (https://www.boost.org/doc/libs/1_66_0/libs/uuid/doc/uuid.html#Concept:NameHashProvider). The data type has changed from typedef unsigned int(&digest_type)[5]; in 1.65 to typedef unsigned char digest_type[ 20 ]; in 1.86.

OgreTransporter avatar May 24 '24 07:05 OgreTransporter

Thanks! However I see a problem: the first 5 elements of digest are written to sstream. Previously, digest only had 5 elements (each 4 bytes), but in Boost 1.86 it has 20 elements, each 1 byte. So effectively, the generated filename gets shorter/less unique. Maybe something like the following could solve this:

for(int i=0; i<5; ++i) {
  sstream << std::hex << *(reinterpret_cast<unsigned int*>(&digest[0])+i);
}

mvieth avatar May 24 '24 13:05 mvieth

I agree! I've updated the PR.

OgreTransporter avatar May 24 '24 14:05 OgreTransporter