title: How to get a hex string from Rust's MD-5 (MD5) crate?
body: <p>According to this RFC about WWW Authentication (used in HTTTP) <a href="https://www.rfc-editor.org/rfc/rfc2617#page-7" rel="nofollow noreferrer">https://www.rfc-editor.org/rfc/rfc2617#page-7</a>,</p>
  <blockquote>
  <p>For the purposes of this document, an MD5 digest of 128 bits is<br />
  represented as 32 ASCII printable characters. The bits in the 128 bit
  digest are converted from most significant to least significant bit,<br />
  four bits at a time to their ASCII presentation as follows. Each four
  bits is represented by its familiar hexadecimal notation from the<br />
  characters 0123456789abcdef. That is, binary 0000 gets represented by
  the character '0', 0001, by '1', and so on up to the representation<br />
  of 1111 as 'f'.</p>
  </blockquote>
  <p>Rust's <a href="https://crates.io/crates/md-5" rel="nofollow noreferrer">MD5 crate</a> implements the Digest trait: <a href="https://docs.rs/digest/0.9.0/digest/trait.Digest.html" rel="nofollow noreferrer">https://docs.rs/digest/0.9.0/digest/trait.Digest.html</a> which digests to a GenericArray which consists of <code>8</code> 16-bit slices.</p>
  <p>How do I convert for this hash format from RFC? Why doesn't the md-5 crate has a simple feature that displays the digest as hexadecimal values?</p>
  <p>The crate <code>literal_hex</code> does the opposite: converts from String of hexadecimal concatenated values to bytes.</p>