Skip to content

Commit

Permalink
Deploying to gh-pages from @ 3aef6e4 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
cgay committed May 13, 2024
1 parent ad406cb commit d10e58b
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 29 deletions.
26 changes: 13 additions & 13 deletions _sources/index.rst.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
***************************
The hash-algorithms Library
***************************
***************
hash-algorithms
***************

.. current-library:: hash-algorithms
.. current-module:: hash-algorithms
Expand All @@ -20,13 +20,14 @@ after each hash:

.. code-block:: dylan
let digest = sha1("Some text");
sha1("Some text"); // => {<simple-byte-vector> sequence 2, 217, 44, 88, 13, 78, ... }
If you want a printable digest, use :meth:`hexdigest(<byte-vector>)`:

.. code-block:: dylan
let hexdigest = hexdigest(sha1("Some text"));
hexdigest(sha1("Some text"))
// => "02D92C580D4EDE6C80A878BDD9F3142D8F757BE8"
If you want to hash multiple strings into a single digest (useful when streaming),
you can use the :gf:`update-hash` and :gf:`digest` functions:
Expand All @@ -37,9 +38,8 @@ you can use the :gf:`update-hash` and :gf:`digest` functions:
update-hash(hash, "Some");
update-hash(hash, " ");
update-hash(hash, "text");
let digest = digest(hash);
// hexdigest works on hashes as well:
let hexdigest = hexdigest(hash);
digest(hash); // => {<simple-byte-vector> sequence 2, 217, 44, 88, 13, 78, 222, ...}
hexdigest(hash); // => "EA1C208EFBF629C89F52D165045B1716EA8EB012"
The hash-algorithms Module
==========================
Expand Down Expand Up @@ -80,7 +80,7 @@ The hash-algorithms Module
Add more data to the hash. This is useful when streaming data or the data is
available in multiple strings and you wish to avoid the overhead of concatenation.

Calling ``update-hash`` multiple times is equivalent to calling it once with
Calling :gf:`update-hash` multiple times is equivalent to calling it once with
a concatenation of the arguments:

.. code-block:: dylan
Expand All @@ -89,13 +89,13 @@ The hash-algorithms Module
update-hash(hash-separate, "Some");
update-hash(hash-separate, " ");
update-hash(hash-separate, "text");
let digest-separate = digest(hash-separate);
digest(hash-separate);
// => {<simple-byte-vector> sequence 2, 217, 44, 88, 13, 78, 222, ... }
let hash-combined = make(<sha1>);
update-hash(hash-combined, "Some text");
let digest-combined = digest(hash-combined);
// digest-separate and digest-combined will be the same
digest(hash-combined);
// => {<simple-byte-vector> sequence 2, 217, 44, 88, 13, 78, 222, ... }
:seealso:

Expand Down
26 changes: 13 additions & 13 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@
</label>
</div>
<article role="main">
<section id="the-hash-algorithms-library">
<h1>The hash-algorithms Library<a class="headerlink" href="#the-hash-algorithms-library" title="Permalink to this heading">#</a></h1>
<section id="hash-algorithms">
<h1>hash-algorithms<a class="headerlink" href="#hash-algorithms" title="Permalink to this heading">#</a></h1>
<p>The hash-algorithms library provides consistent access to a variety of
hash algorithms:</p>
<ul class="simple">
Expand All @@ -201,11 +201,12 @@ <h1>The hash-algorithms Library<a class="headerlink" href="#the-hash-algorithms-
</ul>
<p>Hashing an entire string at once can be done via the functions named
after each hash:</p>
<div class="highlight-dylan notranslate"><div class="highlight"><pre><span></span><span class="k">let</span><span class="w"> </span><span class="n">digest</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">sha1</span><span class="p">(</span><span class="s">&quot;Some text&quot;</span><span class="p">);</span>
<div class="highlight-dylan notranslate"><div class="highlight"><pre><span></span><span class="n">sha1</span><span class="p">(</span><span class="s">&quot;Some text&quot;</span><span class="p">);</span><span class="w"> </span><span class="c1">// =&gt; {&lt;simple-byte-vector&gt; sequence 2, 217, 44, 88, 13, 78, ... }</span>
</pre></div>
</div>
<p>If you want a printable digest, use <a class="reference internal" href="#hash-algorithms:hash-algorithms:hexdigest([byte-vector])"><code class="xref dylan dylan-meth docutils literal notranslate"><span class="pre">hexdigest(&lt;byte-vector&gt;)</span></code></a>:</p>
<div class="highlight-dylan notranslate"><div class="highlight"><pre><span></span><span class="k">let</span><span class="w"> </span><span class="n">hexdigest</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">hexdigest</span><span class="p">(</span><span class="n">sha1</span><span class="p">(</span><span class="s">&quot;Some text&quot;</span><span class="p">));</span>
<div class="highlight-dylan notranslate"><div class="highlight"><pre><span></span><span class="n">hexdigest</span><span class="p">(</span><span class="n">sha1</span><span class="p">(</span><span class="s">&quot;Some text&quot;</span><span class="p">))</span>
<span class="c1">// =&gt; &quot;02D92C580D4EDE6C80A878BDD9F3142D8F757BE8&quot;</span>
</pre></div>
</div>
<p>If you want to hash multiple strings into a single digest (useful when streaming),
Expand All @@ -214,9 +215,8 @@ <h1>The hash-algorithms Library<a class="headerlink" href="#the-hash-algorithms-
<span class="n">update-hash</span><span class="p">(</span><span class="n">hash</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;Some&quot;</span><span class="p">);</span>
<span class="n">update-hash</span><span class="p">(</span><span class="n">hash</span><span class="p">,</span><span class="w"> </span><span class="s">&quot; &quot;</span><span class="p">);</span>
<span class="n">update-hash</span><span class="p">(</span><span class="n">hash</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;text&quot;</span><span class="p">);</span>
<span class="k">let</span><span class="w"> </span><span class="n">digest</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">digest</span><span class="p">(</span><span class="n">hash</span><span class="p">);</span>
<span class="c1">// hexdigest works on hashes as well:</span>
<span class="k">let</span><span class="w"> </span><span class="n">hexdigest</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">hexdigest</span><span class="p">(</span><span class="n">hash</span><span class="p">);</span>
<span class="n">digest</span><span class="p">(</span><span class="n">hash</span><span class="p">);</span><span class="w"> </span><span class="c1">// =&gt; {&lt;simple-byte-vector&gt; sequence 2, 217, 44, 88, 13, 78, 222, ...}</span>
<span class="n">hexdigest</span><span class="p">(</span><span class="n">hash</span><span class="p">);</span><span class="w"> </span><span class="c1">// =&gt; &quot;EA1C208EFBF629C89F52D165045B1716EA8EB012&quot;</span>
</pre></div>
</div>
<section id="the-hash-algorithms-module">
Expand Down Expand Up @@ -290,19 +290,19 @@ <h2>The hash-algorithms Module<a class="headerlink" href="#the-hash-algorithms-m
<dt class="field-odd">Discussion<span class="colon">:</span></dt>
<dd class="field-odd"><p><p>Add more data to the hash. This is useful when streaming data or the data is
available in multiple strings and you wish to avoid the overhead of concatenation.</p>
<p>Calling <code class="docutils literal notranslate"><span class="pre">update-hash</span></code> multiple times is equivalent to calling it once with
<p>Calling <a class="reference internal" href="#hash-algorithms:hash-algorithms:update-hash"><code class="xref dylan dylan-gf docutils literal notranslate"><span class="pre">update-hash</span></code></a> multiple times is equivalent to calling it once with
a concatenation of the arguments:</p>
<div class="highlight-dylan notranslate"><div class="highlight"><pre><span></span><span class="k">let</span><span class="w"> </span><span class="n">hash-separate</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">make</span><span class="p">(</span><span class="nc">&lt;sha1&gt;</span><span class="p">);</span>
<span class="n">update-hash</span><span class="p">(</span><span class="n">hash-separate</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;Some&quot;</span><span class="p">);</span>
<span class="n">update-hash</span><span class="p">(</span><span class="n">hash-separate</span><span class="p">,</span><span class="w"> </span><span class="s">&quot; &quot;</span><span class="p">);</span>
<span class="n">update-hash</span><span class="p">(</span><span class="n">hash-separate</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;text&quot;</span><span class="p">);</span>
<span class="k">let</span><span class="w"> </span><span class="n">digest-separate</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">digest</span><span class="p">(</span><span class="n">hash-separate</span><span class="p">);</span>
<span class="n">digest</span><span class="p">(</span><span class="n">hash-separate</span><span class="p">);</span>
<span class="c1">// =&gt; {&lt;simple-byte-vector&gt; sequence 2, 217, 44, 88, 13, 78, 222, ... }</span>

<span class="k">let</span><span class="w"> </span><span class="n">hash-combined</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">make</span><span class="p">(</span><span class="nc">&lt;sha1&gt;</span><span class="p">);</span>
<span class="n">update-hash</span><span class="p">(</span><span class="n">hash-combined</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;Some text&quot;</span><span class="p">);</span>
<span class="k">let</span><span class="w"> </span><span class="n">digest-combined</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">digest</span><span class="p">(</span><span class="n">hash-combined</span><span class="p">);</span>

<span class="c1">// digest-separate and digest-combined will be the same</span>
<span class="n">digest</span><span class="p">(</span><span class="n">hash-combined</span><span class="p">);</span>
<span class="c1">// =&gt; {&lt;simple-byte-vector&gt; sequence 2, 217, 44, 88, 13, 78, 222, ... }</span>
</pre></div>
</div>
</p>
Expand Down Expand Up @@ -638,7 +638,7 @@ <h3>SHA-2<a class="headerlink" href="#sha-2" title="Permalink to this heading">#
<div class="toc-tree-container">
<div class="toc-tree">
<ul>
<li><a class="reference internal" href="#">The hash-algorithms Library</a><ul>
<li><a class="reference internal" href="#">hash-algorithms</a><ul>
<li><a class="reference internal" href="#the-hash-algorithms-module">The hash-algorithms Module</a><ul>
<li><a class="reference internal" href="#md5">MD5</a></li>
<li><a class="reference internal" href="#sha-1">SHA-1</a></li>
Expand Down
4 changes: 2 additions & 2 deletions objects.inv
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# Project: Hash Algorithms
# Version:
# The remainder of this file is compressed using zlib.
xڭ��j�0��~
A{h*MZ�bL��@ ��r���%*[�RJܧ���!�t��η��IQl�h#Hg�(��/)�.ĝ�1���f����;[�#$]8��b#K������e#,�\aa4��_]73�.W�0C��T��+�=��Pf���6�AQ��Ҟ0~Vbp�mU�f�����р!Ӳ�/�IH&�z�{j�ٸ6�������lv|@Lj�`���$��d�s�(1��J�Ѱ~L*����4$�p����2��v�6��P^� ծ��<�Q�٦I�t�z�iM�&($�0�j� t�I�Y��mۘ�s�Rgln�j��ӷ$����~�
xڭ�Ok�0�"��!cu� �Ž= �K1I�,&b���K�W-�Q��y��g�}R���q$̑R�����3��c�x!�R�J%��{p0H+�8&�3����c�Eo��f,޺b�v�^�]of� �7�#f��\�o��_:r�V`]Jq��h(RTiO��+1z^ݪ��Ir�3O����P�es �e�.���[���^�8 L����Ĵ� o}0�)>�g�� 2;r���CT�}(M�r��y֛�#ۃ�}
*nd��a{ؼ����b��NA%����4b������b�O,�Lm�:�(j0[��!�5�3T���z\
Expand Down
Loading

0 comments on commit d10e58b

Please sign in to comment.