PointCloudLibrary / pcl

Point Cloud Library (PCL)
https://pointclouds.org/
Other
9.89k stars 4.61k forks source link

Fix boost hash data type #6053

Closed OgreTransporter closed 4 months ago

OgreTransporter commented 4 months ago

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.

mvieth commented 4 months ago

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);
}
OgreTransporter commented 4 months ago

I agree! I've updated the PR.