<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Last year, Howard Hinnant proposed a composable hash algorithm framework for C++ that I was impressed with.<div class=""><br class=""></div><div class="">His proposal is here: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3980.html" class="">http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3980.html</a></div><div class="">A live presentation is here: <a href="https://www.youtube.com/watch?v=Njjp_MJsgt8" class="">https://www.youtube.com/watch?v=Njjp_MJsgt8</a></div><div class=""><br class=""></div><div class="">A type with multiple fields you inevitably want to do a hash_combine but this pollutes the hashing algorithm. It turns out that (nearly) all hashing algorithms can be abstracted into 3 phases: initialization, digestion and finalization. It might be cool if Swift Hashable adopted this pluggable architecture. </div><div class=""><br class=""></div><div class="">1. Easily adopt Hashable</div><div class="">2. Easily change and compare hash algorithms based on performance / security needs</div><div class="">3. Make good hash implementations trivial for users.</div><div class=""><br class=""></div><div class="">Wondering if anyone has thought about this already / if it would be worthwhile pursuing more.</div><div class=""><br class=""></div><div class="">Best wishes,</div><div class="">Ray</div><div class=""><br class=""></div><div class="">PS: I have always thought that it is a bummer that compound types such as tuples can’t conform to protocols and therefore be Hashable. </div><div class=""><br class=""></div></body></html>