<remark>Remove dangling reference to analysis of hash function use in existing XMPP extensions. It can still be found in XEP-0300, version 0.5 (<https://xmpp.org/extensions/attic/xep-0300-0.5.html#existing>). Thanks to Dennis Baurichter for pointing this out.</remark>
<remark>Accepted by vote of Council on 2019-01-16.</remark>
</revision>
<revision>
<version>0.0.1</version>
<date>2019-01-13</date>
<initials>psa</initials>
<remark><p>Split from XEP-0300.</p></remark>
</revision>
</header>
<section1topic='Introduction'anchor='intro'>
<p>Various XMPP extensions make use of cryptographic hash functions, but they do so in different ways (e.g., some define XML elements and some define XML attributes) and often mandate support for different algorithms.</p>
<p>This specification provides recommendations from the XMPP council as to which cryptographic hash functions should and should not be used by XMPP entities.</p>
<section2topic='Relationship with Specifications'anchor='intro-other-specs'>
<p>This recommendation does not specify the hash algorithms themselves; it merely refers to existing algorithms.</p>
<p>&xep0300; (which historically has contained the recommendations in this specification) describes a common wire-format to be used to transport hash function values in XMPP.</p>
</section2>
</section1>
<section1topic='Requirements'anchor='reqs'>
<p>This recommendation should meet the following goals:</p>
<ul>
<li>Provide clear guidance on which hash functions should be supported by an XMPP entity at any point in time.</li>
<li>Recommend both a set of well-supported functions as MUST and a set of future functions as SHOULD to allow the ecosystem to transit to newer functions.</li>
</ul>
<p>This specification is <em>not</em> meant to override recommendations or requirements laid out by other specifications. Other specifications can however defer their recommendations or requirements to this specification.</p>
</section1>
<section1topic='Use Cases'anchor='usecases'>
<p>A specification which makes use of cryptographic hash functions (such as &xep0234; or &xep0390;) can refer to this specification instead of making recommendations on hash functions on their own.</p>
<p>If a protocol specification defers its decision on hash functions to this document, it should support transporting multiple hashes at the same time (preferably using &xep0300;).</p>
<p>By default, when an entity receives multiple hash function values for the same input, it SHOULD either (a) use all hash values or (b) the hash value of the algroithm with the most security confidence for verification purposes.</p>
</section1>
<section1topic='Hash Functions'anchor='hashes'>
<section2topic='MD2'anchor='hashes-md2'>
<p>The MD2 algorithm is not used in any XMPP protocols and has been deprecated by the IETF (see &rfc6149;).</p>
</section2>
<section2topic='MD4'anchor='hashes-md4'>
<p>The MD4 algorithm is not used in any XMPP protocols and has been deprecated by the IETF (see &rfc6150;).</p>
</section2>
<section2topic='MD5'anchor='hashes-md5'>
<p>The MD5 algorithm was commonly used in earlier generations of Internet technologies. As explained in &rfc6151;, the MD5 algorithm "is no longer acceptable where collision resistance is required" (such as in digital signatures) and "new protocol designs should not employ HMAC-MD5" either.</p>
<p>The currently known best attack against the pre-image resistance property of the MD5 algorithm is slightly better than the generic attack and was released 2009 <note>Yu Sasaki and Kazumaro Aoki, "Finding preimages in full MD5 faster than exhaustive search" <<linkurl='https://doi.org/10.1007/978-3-642-01001-9_8'>https://doi.org/10.1007/978-3-642-01001-9_8</link>>.</note>.</p>
<p>The primary use of MD5 in XMPP protocols is &xep0096;, which will be obsoleted by &xep0234;.</p>
</section2>
<section2topic='SHA-0'anchor='hashes-sha0'>
<p>The SHA-0 algorithm was developed by the U.S. National Security Agency and first published in 1993. It was never widely deployed and is not used in any XMPP protocols.</p>
</section2>
<section2topic='SHA-1'anchor='hashes-sha1'>
<p>The SHA-1 algorithm was developed by the U.S. National Security Agency and first published in 1995 to fix problems with SHA-0. The SHA-1 algorithm is currently the most widely-deployed hash function. As described in &rfc4270; in 2005, attacks have been found against the collision resistance property of SHA-1. &rfc6194; notes that as of 2011 no published results indicate improvement upon those attacks. In addition, RFC 6194 notes that "[t]here are no known pre-image or second pre-image attacks that are specific to the full round SHA-1 algorithm". Furthermore, there is no indication that attacks on SHA-1 can be extended to HMAC-SHA-1. Nevertheless, the U.S. National Institute of Standards and Technology (NIST) has recommended that SHA-1 not be used for generating digital signatures after December 31, 2010.</p>
<p>In fall 2015 the SHA-1 collision cost has been estimated between 75K$ to 120K$ <note>The SHAppening: freestart collisions for SHA-1 <<linkurl='https://sites.google.com/site/itstheshappening/'>https://sites.google.com/site/itstheshappening/</link>>.</note>.</p>
</section2>
<section2topic='SHA-2'anchor='hashes-sha2'>
<p>The SHA-2 family of algorithms (SHA-224, SHA-256, SHA-384, and SHA-512) was developed by the U.S. National Security Agency and first published in 2001. Because SHA-2 is somewhat similar to SHA-1, it is thought that the security flaws with SHA-1 described above could be extended to SHA-2 (although no such attacks have yet been found on the full-round SHA-2 algorithms).</p>
</section2>
<section2topic='SHA-3'anchor='hashes-sha3'>
<p>The SHA-3 family of algorithms (SHA3-224, SHA3-256, SHA3-384, and SHA3-512) is based on the Keccak algortihm developed by Guido Bertoni, Joan Daemen, Michaël Peeters, and Gilles Van Assche, and was pubished by NIST on August 5, 2015 in <spanclass='ref'><linkurl='http://dx.doi.org/10.6028/NIST.FIPS.202'>FIPS PUB 202: SHA-3 Standard: Permutation-Based Hash and Extendable-Output Functions</link></span><note>FIPS PUB 202: SHA-3 Standard: Permutation-Based Hash and Extendable-Output Functions <<linkurl='http://dx.doi.org/10.6028/NIST.FIPS.202'>http://dx.doi.org/10.6028/NIST.FIPS.202</link>>.</note> after a public hash function competition.</p>
</section2>
<section2topic='BLAKE2'anchor='hashes-blake2'>
<p>The BLAKE2 family of algorithms was designed by Jean-Philippe Aumasson, Samuel Neves, Zooko Wilcox-O'Hearn, and Christian Winnerlein. It is described in &rfc7693; and is designed to be highly secure and run well on both software and hardware platforms.</p>