Boost C++ Libraries: Ticket #11769: 64-bit hash_combine has weakness against zero input https://svn.boost.org/trac10/ticket/11769 <p> The <code>hash_combine_impl</code> function for 64-bit <code>size_t</code> (see <a class="ext-link" href="https://github.com/boostorg/functional/blob/develop/include/boost/functional/hash/hash.hpp#L237"><span class="icon">​</span>here</a>) does not have an additive component. As a result, hashing strings of zeros always results in zero hash value regardless of the length of the string. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11769 Trac 1.4.3 Andrey Semashev Wed, 28 Oct 2015 13:27:38 GMT description changed https://svn.boost.org/trac10/ticket/11769#comment:1 https://svn.boost.org/trac10/ticket/11769#comment:1 <ul> <li><strong>description</strong> modified (<a href="/trac10/ticket/11769?action=diff&amp;version=1">diff</a>) </li> </ul> Ticket Daniel James Wed, 13 Jan 2016 23:55:34 GMT status changed https://svn.boost.org/trac10/ticket/11769#comment:2 https://svn.boost.org/trac10/ticket/11769#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> <p> You're right about the function but it turns out that there's no real problem for an embarrassing reason - that function has a spurious template argument so it's never used. </p> <p> There are unit tests for this exact problem (in <code>hash_sequence_test.hpp</code>), and I'm relieved to say that they would have been caught the problem if that function was actually used, so at least I got that right. </p> <p> I think I'll fix the function and put it to use. I had originally intended to do more rigorous testing of hash quality before releasing it, but ended up having little time. I think I'll be more cautious this time, so the new version might not make it into the next version of boost. </p> Ticket Daniel James Sun, 08 Oct 2017 14:51:02 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/11769#comment:3 https://svn.boost.org/trac10/ticket/11769#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> Ticket