title: Ruby: difference between hexencode and hexdigest
body: <p>Today I read the documentation on Rubies hexdigest method, e.g.</p>
  
  <pre><code>Digest::SHA256.hexdigest('123')
  =&gt; "a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3"
  </code></pre>
  
  <p><a href="https://ruby-doc.org/stdlib-2.4.2/libdoc/digest/rdoc/Digest/Class.html#method-c-hexdigest" rel="nofollow noreferrer">The documentation</a> says:</p>
  
  <blockquote>
    <p>Returns the hex-encoded hash value of a given string. This is <strong>almost</strong> equivalent to <code>Digest.hexencode(Digest::Class.new(*parameters).digest(string))</code>.</p>
  </blockquote>
  
  <p>Highlighting is by me: What does almost mean here? How is it different?</p>
  
  <p>Of course my example string above yields the same result:</p>
  
  <pre><code>Digest.hexencode(Digest::SHA256.digest('123'))
  =&gt; "a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3"
  </code></pre>
  
  <p>Can anyone point me to the cases where the result can be different? I want to understand whether the "almost" points to an important difference or if the difference is irrelevant for me.</p>