<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Tue, 23 Oct 2018 at 08:45, Miguel Ojeda via Boost-users &lt;<a href="mailto:boost-users@lists.boost.org">boost-users@lists.boost.org</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Mon, Oct 22, 2018 at 7:57 PM Shailja Prasad via Boost-users<br>
&lt;<a href="mailto:boost-users@lists.boost.org" target="_blank">boost-users@lists.boost.org</a>&gt; wrote:<br>
&gt;<br>
&gt; I was trying to upgrade boost 1.53.0 to boost 1.68.0. But, it looks like hashing code generation has changed, since the following line gives two different hashcode for same string input.<br>
<br>
Hm... why would you expect the hash to be always the same between<br>
releases, compilers, etc.?</blockquote><div><br></div><div>Well, uhm, because that seems to be quite handy. All NIST implementations do exactly this.<br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> I cannot find it with a quick look at<br>
Boost.Hash&#39;s docs anything regarding a guarantee of that. If it is<br>
like std::hash, then it is only guaranteed to remain equal for the<br>
duration of the program.</blockquote><div><br></div><div>Sort of: &quot;Hash functions are only required to produce the same result for the same input within a single execution of a program&quot;. The standard states a minimum requirement [with an intended [narrow] use case in mind, std::ordered_map&#39;s]. I&#39;m not sure that is a great one and by the time we might [would like to] have constexpr std::ordered_map maybe not even tenable.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">In other words, you cannot rely on saving it<br>
nor comparing them to other hashes from other vendors, platforms,<br>
architectures, compiler releases, etc.<br></blockquote><div><br></div><div>In my view this is an omission, the option to have exactly that should [have been] available.<br></div></div><div><br></div><div>degski<br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><i><b><span><i><b>“</b></i></span>If something cannot go on forever, it will stop&quot; - Herbert Stein</b></i></div></div></div></div></div></div></div>