Clean up description in SHA256 example

This commit is contained in:
Eli Bendersky 2022-03-31 05:45:19 -07:00
parent ac01d2d4bb
commit ed7a093662
3 changed files with 5 additions and 12 deletions

View File

@ -28,9 +28,6 @@ func main() {
// to an existing byte slice: it usually isn't needed.
bs := h.Sum(nil)
// SHA256 values are often printed in hex, for example
// in git commits. Use the `%x` format verb to convert
// a hash results to a hex string.
fmt.Println(s)
fmt.Printf("%x\n", bs)
}

View File

@ -1,2 +1,2 @@
21f16c864c11958f29949c491a9684bcb885831f
jIQtrUxWLvq
66d0faf25cd171218b0fc0fc341836a4f0069932
IHM1lZVm_Jm

10
public/sha256-hashes generated
View File

@ -45,7 +45,7 @@ SHA256 hashes in Go.</p>
</td>
<td class="code leading">
<a href="http://play.golang.org/p/jIQtrUxWLvq"><img title="Run code" src="play.png" class="run" /></a><img title="Copy code" src="clipboard.png" class="copy" />
<a href="http://play.golang.org/p/IHM1lZVm_Jm"><img title="Run code" src="play.png" class="run" /></a><img title="Copy code" src="clipboard.png" class="copy" />
<pre class="chroma"><span class="kn">package</span> <span class="nx">main</span>
</pre>
</td>
@ -124,15 +124,11 @@ to an existing byte slice: it usually isn&rsquo;t needed.</p>
<tr>
<td class="docs">
<p>SHA256 values are often printed in hex, for example
in git commits. Use the <code>%x</code> format verb to convert
a hash results to a hex string.</p>
</td>
<td class="code">
<pre class="chroma">
<span class="nx">fmt</span><span class="p">.</span><span class="nf">Println</span><span class="p">(</span><span class="nx">s</span><span class="p">)</span>
<pre class="chroma"> <span class="nx">fmt</span><span class="p">.</span><span class="nf">Println</span><span class="p">(</span><span class="nx">s</span><span class="p">)</span>
<span class="nx">fmt</span><span class="p">.</span><span class="nf">Printf</span><span class="p">(</span><span class="s">&#34;%x\n&#34;</span><span class="p">,</span> <span class="nx">bs</span><span class="p">)</span>
<span class="p">}</span>
</pre>