Skip to content

Commit 8827ef0

Browse files
committed
ZIP 32: update spec references.
Signed-off-by: Daira Hopwood <[email protected]>
1 parent 98b01fe commit 8827ef0

File tree

2 files changed

+74
-20
lines changed

2 files changed

+74
-20
lines changed

zip-0032.html

Lines changed: 59 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<section id="terminology">
2121
<h2>Terminology</h2>
2222
<p>The key words "MUST", "MUST NOT", and "MAY" in this document are to be interpreted as described in RFC 2119. <a href="#rfc2119" id="id1" class="footnote_reference">1</a></p>
23-
<p>"Jubjub" refers to the elliptic curve defined in <a href="#sapling-spec" id="id2" class="footnote_reference">8</a> section 5.4.8.3.</p>
23+
<p>"Jubjub" refers to the elliptic curve defined in <a href="#sapling-jubjub" id="id2" class="footnote_reference">12</a>.</p>
2424
</section>
2525
<section id="abstract">
2626
<h2>Abstract</h2>
@@ -49,14 +49,14 @@ <h2>Conventions</h2>
4949
<li>LEOS2IP<sub>l</sub>(<em>S</em>) is the integer in range {0..2<sup>l</sup>-1} represented in little-endian order by the byte sequence <em>S</em> of length <em>l</em>/8.</li>
5050
<li>I2LEBSP<sub>l</sub>(<em>k</em>) is the sequence of <em>l</em> bits representing <em>k</em> in little-endian order.</li>
5151
<li>LEBS2OSP<sub>l</sub>(<em>B</em>) is defined as follows when <em>l</em> is a multiple of 8: convert each group of 8 bits in <em>B</em> to a byte value with the least significant bit first, and concatenate the resulting bytes in the same order as the groups.</li>
52-
<li>repr<sub>𝕁</sub>(<em>P</em>) is the representation of the Jubjub elliptic curve point <em>P</em> as a bit sequence, defined in <a href="#sapling-spec" id="id9" class="footnote_reference">8</a> section 5.4.8.3.</li>
52+
<li>repr<sub>𝕁</sub>(<em>P</em>) is the representation of the Jubjub elliptic curve point <em>P</em> as a bit sequence, defined in <a href="#sapling-jubjub" id="id9" class="footnote_reference">12</a>.</li>
5353
<li>BLAKE2b-256(<em>p</em>, <em>x</em>) refers to unkeyed BLAKE2b-256 in sequential mode, with an output digest length of 32 bytes, 16-byte personalization string <em>p</em>, and input <em>x</em>.</li>
5454
<li>BLAKE2b-512(<em>p</em>, <em>x</em>) refers to unkeyed BLAKE2b-512 in sequential mode, with an output digest length of 64 bytes, 16-byte personalization string <em>p</em>, and input <em>x</em>.</li>
5555
<li>PRF<sup>expand</sup>(<em>sk</em>, <em>t</em>) := BLAKE2b-512("Zcash_ExpandSeed", <em>sk</em> || <em>t</em>)</li>
5656
<li>ToScalar(<em>x</em>) := LEOS2IP<sub>512</sub>(<em>x</em>) (mod <em>r</em><sub>𝕁</sub>), where <em>r</em><sub>𝕁</sub> is the order of the Jubjub large prime subgroup.</li>
57-
<li>DiversifyHash(<em>d</em>) maps a diversifier <em>d</em> to a base point on the Jubjub elliptic curve, or to ⊥ if the diversifier is invalid. It is instantiated in <a href="#sapling-spec" id="id10" class="footnote_reference">8</a> section 5.4.1.6.</li>
57+
<li>DiversifyHash(<em>d</em>) maps a diversifier <em>d</em> to a base point on the Jubjub elliptic curve, or to ⊥ if the diversifier is invalid. It is instantiated in <a href="#sapling-diversifyhash" id="id10" class="footnote_reference">10</a>.</li>
5858
</ul>
59-
<p>The following algorithm standardized in <a href="#nist-sp-800-38g" id="id11" class="footnote_reference">10</a> is used:</p>
59+
<p>The following algorithm standardized in <a href="#nist-sp-800-38g" id="id11" class="footnote_reference">16</a> is used:</p>
6060
<ul>
6161
<li>FF1-AES256.Encrypt(<em>key</em>, <em>tweak</em>, <em>x</em>) refers to the FF1 encryption algorithm using AES with a 256-bit <em>key</em>, and parameters <em>radix</em> = 2, <em>minlen</em> = 88, <em>maxlen</em> = 88. It will be used only with the empty string "" as the <em>tweak</em>. <em>x</em> is a sequence of 88 bits, as is the output.</li>
6262
</ul>
@@ -139,7 +139,7 @@ <h4>Deriving a child extended spending key</h4>
139139
</section>
140140
<section id="deriving-a-child-extended-full-viewing-key">
141141
<h4>Deriving a child extended full viewing key</h4>
142-
<p>Let 𝓖 be as defined in <a href="#sapling-spec" id="id16" class="footnote_reference">8</a> section 5.4.6.1 and let 𝓗 be as defined in <a href="#sapling-key-components" id="id17" class="footnote_reference">9</a>.</p>
142+
<p>Let 𝓖 be as defined in <a href="#sapling-spendauthsig" id="id16" class="footnote_reference">11</a> and let 𝓗 be as defined in <a href="#sapling-key-components" id="id17" class="footnote_reference">9</a>.</p>
143143
<p>CDKfvk((<em>ak</em><sub>par</sub>, <em>nk</em><sub>par</sub>, <em>ovk</em><sub>par</sub>, <em>dk</em><sub>par</sub>, <em>c</em><sub>par</sub>), <em>i</em>) → (<em>ak</em><sub>i</sub>, <em>nk</em><sub>i</sub>, <em>ovk</em><sub>i</sub>, <em>dk</em><sub>i</sub>, <em>c</em><sub>i</sub>)</p>
144144
<ul>
145145
<li>Check whether <em>i</em> ≥ 2<sup>31</sup> (whether the child is a hardened key).
@@ -184,7 +184,7 @@ <h3>Sprout extended keys</h3>
184184
</section>
185185
<section id="sprout-helper-functions">
186186
<h3>Sprout helper functions</h3>
187-
<p>Let EncodeASK(<em>a</em><sub>sk</sub>) be the 32-byte encoding of <em>a</em><sub>sk</sub> in the raw encoding of a Sprout spending key (excluding lead bytes) as specified in <a href="#sapling-spec" id="id18" class="footnote_reference">8</a> section 5.6.8.</p>
187+
<p>Let EncodeASK(<em>a</em><sub>sk</sub>) be the 32-byte encoding of <em>a</em><sub>sk</sub> in the raw encoding of a Sprout spending key (excluding lead bytes) as specified in <a href="#sprout-spending-keys" id="id18" class="footnote_reference">15</a>.</p>
188188
<p>Let DecodeASK(<em>ASK</em>) be the result of clearing the 4 most significant bits of the first byte of <em>ASK</em>, and decoding the 32-byte result according to the inverse of EncodeASK.</p>
189189
</section>
190190
<section id="sprout-master-key-generation">
@@ -246,7 +246,7 @@ <h3>Sprout key path</h3>
246246
<h2>Specification: Fingerprints and Tags</h2>
247247
<section id="sapling-full-viewing-key-fingerprints-and-tags">
248248
<h3>Sapling Full Viewing Key Fingerprints and Tags</h3>
249-
<p>A "Sapling full viewing key fingerprint" of a full viewing key with raw encoding <em>FVK</em> (as specified in <a href="#sapling-spec" id="id23" class="footnote_reference">8</a> section 5.6.7) is given by:</p>
249+
<p>A "Sapling full viewing key fingerprint" of a full viewing key with raw encoding <em>FVK</em> (as specified in <a href="#sapling-full-viewing-keys" id="id23" class="footnote_reference">14</a>) is given by:</p>
250250
<blockquote>
251251
<p>BLAKE2b-256("ZcashSaplingFVFP", <em>FVK</em>)</p>
252252
</blockquote>
@@ -255,7 +255,7 @@ <h3>Sapling Full Viewing Key Fingerprints and Tags</h3>
255255
</section>
256256
<section id="sprout-address-fingerprints-and-tags">
257257
<h3>Sprout Address Fingerprints and Tags</h3>
258-
<p>A "Sprout address fingerprint" of a Sprout payment address with raw encoding <em>ADDR</em> (as specified in <a href="#sapling-spec" id="id24" class="footnote_reference">8</a> section 5.6.3, including the lead bytes) is given by:</p>
258+
<p>A "Sprout address fingerprint" of a Sprout payment address with raw encoding <em>ADDR</em> (as specified in <a href="#sprout-shielded-addresses" id="id24" class="footnote_reference">13</a>, including the lead bytes) is given by:</p>
259259
<blockquote>
260260
<p>BLAKE2b-256("Zcash_Sprout_AFP", <em>ADDR</em>)</p>
261261
</blockquote>
@@ -378,22 +378,70 @@ <h2>References</h2>
378378
<tbody>
379379
<tr>
380380
<th>8</th>
381-
<td><a href="https://github.com/zcash/zips/blob/master/protocol/protocol.pdf">Zcash Protocol Specification, Version 2018.0-beta-25 or later [Overwinter+Sapling]</a></td>
381+
<td><a href="protocol/protocol.pdf">Zcash Protocol Specification, Version 2019.0.8 or later [Overwinter+Sapling+Blossom]</a></td>
382382
</tr>
383383
</tbody>
384384
</table>
385385
<table id="sapling-key-components" class="footnote">
386386
<tbody>
387387
<tr>
388388
<th>9</th>
389-
<td><a href="https://github.com/zcash/zips/blob/master/protocol/protocol.pdf">Section 4.2.2: Sapling Key Components. Zcash Protocol Specification, Version 2018.0-beta-25 or later [Overwinter+Sapling]</a></td>
389+
<td><a href="protocol/protocol.pdf#saplingkeycomponents">Zcash Protocol Specification, Section 4.2.2 Sapling Key Components</a></td>
390390
</tr>
391391
</tbody>
392392
</table>
393-
<table id="nist-sp-800-38g" class="footnote">
393+
<table id="sapling-diversifyhash" class="footnote">
394394
<tbody>
395395
<tr>
396396
<th>10</th>
397+
<td><a href="protocol/protocol.pdf#concretediversifyhash">Zcash Protocol Specification, Section 5.4.1.6 DiversifyHash Hash Function</a></td>
398+
</tr>
399+
</tbody>
400+
</table>
401+
<table id="sapling-spendauthsig" class="footnote">
402+
<tbody>
403+
<tr>
404+
<th>11</th>
405+
<td><a href="protocol/protocol.pdf#concretespendauthsig">Zcash Protocol Specification, Section 5.4.6.1 Spend Authorization Signature</a></td>
406+
</tr>
407+
</tbody>
408+
</table>
409+
<table id="sapling-jubjub" class="footnote">
410+
<tbody>
411+
<tr>
412+
<th>12</th>
413+
<td><a href="protocol/protocol.pdf#jubjub">Zcash Protocol Specification, Section 5.4.8.3 Jubjub</a></td>
414+
</tr>
415+
</tbody>
416+
</table>
417+
<table id="sprout-shielded-addresses" class="footnote">
418+
<tbody>
419+
<tr>
420+
<th>13</th>
421+
<td><a href="protocol/protocol.pdf#sproutpaymentaddrencoding">Zcash Protocol Specification, Section 5.6.3 Sprout Shielded Payment Addresses</a></td>
422+
</tr>
423+
</tbody>
424+
</table>
425+
<table id="sapling-full-viewing-keys" class="footnote">
426+
<tbody>
427+
<tr>
428+
<th>14</th>
429+
<td><a href="protocol/protocol.pdf#saplingfullviewingkeyencoding">Zcash Protocol Specification, Section 5.6.7 Sapling Full Viewing Keys</a></td>
430+
</tr>
431+
</tbody>
432+
</table>
433+
<table id="sprout-spending-keys" class="footnote">
434+
<tbody>
435+
<tr>
436+
<th>15</th>
437+
<td><a href="protocol/protocol.pdf#sproutspendingkeyencoding">Zcash Protocol Specification, Section 5.6.8 Sprout Spending Keys</a></td>
438+
</tr>
439+
</tbody>
440+
</table>
441+
<table id="nist-sp-800-38g" class="footnote">
442+
<tbody>
443+
<tr>
444+
<th>16</th>
397445
<td><a href="https://dx.doi.org/10.6028/NIST.SP.800-38G">NIST Special Publication 800-38G -- Recommendation for Block Cipher Modes of Operation: Methods for Format-Preserving Encryption</a></td>
398446
</tr>
399447
</tbody>

zip-0032.rst

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Terminology
1919
The key words "MUST", "MUST NOT", and "MAY" in this document are to be interpreted as described in RFC 2119.
2020
[#RFC2119]_
2121

22-
"Jubjub" refers to the elliptic curve defined in [#sapling-spec]_ section 5.4.8.3.
22+
"Jubjub" refers to the elliptic curve defined in [#sapling-jubjub]_.
2323

2424

2525
Abstract
@@ -81,7 +81,7 @@ Most of the notation and functions used in this ZIP are defined in the Sapling p
8181
same order as the groups.
8282

8383
- repr\ :sub:`𝕁`\ (*P*) is the representation of the Jubjub elliptic curve point *P* as a bit sequence,
84-
defined in [#sapling-spec]_ section 5.4.8.3.
84+
defined in [#sapling-jubjub]_.
8585

8686
- BLAKE2b-256(*p*, *x*) refers to unkeyed BLAKE2b-256 in sequential mode, with an output digest length of
8787
32 bytes, 16-byte personalization string *p*, and input *x*.
@@ -95,7 +95,7 @@ Most of the notation and functions used in this ZIP are defined in the Sapling p
9595
of the Jubjub large prime subgroup.
9696

9797
- DiversifyHash(*d*) maps a diversifier *d* to a base point on the Jubjub elliptic curve, or to ⊥ if the
98-
diversifier is invalid. It is instantiated in [#sapling-spec]_ section 5.4.1.6.
98+
diversifier is invalid. It is instantiated in [#sapling-diversifyhash]_.
9999

100100
The following algorithm standardized in [#NIST-SP-800-38G]_ is used:
101101

@@ -205,7 +205,7 @@ CDKsk((*ask*\ :sub:`par`\ , *nsk*\ :sub:`par`\ , *ovk*\ :sub:`par`\ , *dk*\ :sub
205205

206206
Deriving a child extended full viewing key
207207
``````````````````````````````````````````
208-
Let 𝓖 be as defined in [#sapling-spec]_ section 5.4.6.1 and let 𝓗 be as defined in [#sapling-key-components]_.
208+
Let 𝓖 be as defined in [#sapling-spendauthsig]_ and let 𝓗 be as defined in [#sapling-key-components]_.
209209

210210
CDKfvk((*ak*\ :sub:`par`\ , *nk*\ :sub:`par`\ , *ovk*\ :sub:`par`\ , *dk*\ :sub:`par`\ , *c*\ :sub:`par`\ ), *i*) →
211211
(*ak*\ :sub:`i`\ , *nk*\ :sub:`i`\ , *ovk*\ :sub:`i`\ , *dk*\ :sub:`i`\ , *c*\ :sub:`i`\ )
@@ -265,7 +265,7 @@ Sprout helper functions
265265
-----------------------
266266

267267
Let EncodeASK(*a*\ :sub:`sk`) be the 32-byte encoding of *a*\ :sub:`sk` in the raw encoding of a Sprout
268-
spending key (excluding lead bytes) as specified in [#sapling-spec]_ section 5.6.8.
268+
spending key (excluding lead bytes) as specified in [#sprout-spending-keys]_.
269269

270270
Let DecodeASK(*ASK*) be the result of clearing the 4 most significant bits of the first byte of *ASK*,
271271
and decoding the 32-byte result according to the inverse of EncodeASK.
@@ -364,7 +364,7 @@ Sapling Full Viewing Key Fingerprints and Tags
364364
----------------------------------------------
365365

366366
A "Sapling full viewing key fingerprint" of a full viewing key with raw encoding *FVK* (as specified
367-
in [#sapling-spec]_ section 5.6.7) is given by:
367+
in [#sapling-full-viewing-keys]_) is given by:
368368

369369
BLAKE2b-256("ZcashSaplingFVFP", *FVK*)
370370

@@ -378,7 +378,7 @@ Sprout Address Fingerprints and Tags
378378
------------------------------------
379379

380380
A "Sprout address fingerprint" of a Sprout payment address with raw encoding *ADDR* (as specified in
381-
[#sapling-spec]_ section 5.6.3, including the lead bytes) is given by:
381+
[#sprout-shielded-addresses]_, including the lead bytes) is given by:
382382

383383
BLAKE2b-256("Zcash_Sprout_AFP", *ADDR*)
384384

@@ -481,7 +481,13 @@ References
481481
.. [#bip-0044] `BIP 44: Multi-Account Hierarchy for Deterministic Wallets <https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki>`_
482482
.. [#slip-0044] `SLIP 44: Registered coin types for BIP-0044 <https://github.com/satoshilabs/slips/blob/master/slip-0044.md>`_
483483
.. [#bip-0173] `BIP 173: Base32 address format for native v0-16 witness outputs <https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki>`_
484-
.. [#sapling-spec] `Zcash Protocol Specification, Version 2018.0-beta-25 or later [Overwinter+Sapling] <https://github.com/zcash/zips/blob/master/protocol/protocol.pdf>`_
485-
.. [#sapling-key-components] `Section 4.2.2: Sapling Key Components. Zcash Protocol Specification, Version 2018.0-beta-25 or later [Overwinter+Sapling] <https://github.com/zcash/zips/blob/master/protocol/protocol.pdf>`_
484+
.. [#sapling-spec] `Zcash Protocol Specification, Version 2019.0.8 or later [Overwinter+Sapling+Blossom] <protocol/protocol.pdf>`_
485+
.. [#sapling-key-components] `Zcash Protocol Specification, Section 4.2.2 Sapling Key Components <protocol/protocol.pdf#saplingkeycomponents>`_
486+
.. [#sapling-diversifyhash] `Zcash Protocol Specification, Section 5.4.1.6 DiversifyHash Hash Function <protocol/protocol.pdf#concretediversifyhash>`_
487+
.. [#sapling-spendauthsig] `Zcash Protocol Specification, Section 5.4.6.1 Spend Authorization Signature <protocol/protocol.pdf#concretespendauthsig>`_
488+
.. [#sapling-jubjub] `Zcash Protocol Specification, Section 5.4.8.3 Jubjub <protocol/protocol.pdf#jubjub>`_
489+
.. [#sprout-shielded-addresses] `Zcash Protocol Specification, Section 5.6.3 Sprout Shielded Payment Addresses <protocol/protocol.pdf#sproutpaymentaddrencoding>`_
490+
.. [#sapling-full-viewing-keys] `Zcash Protocol Specification, Section 5.6.7 Sapling Full Viewing Keys <protocol/protocol.pdf#saplingfullviewingkeyencoding>`_
491+
.. [#sprout-spending-keys] `Zcash Protocol Specification, Section 5.6.8 Sprout Spending Keys <protocol/protocol.pdf#sproutspendingkeyencoding>`_
486492
.. [#NIST-SP-800-38G] `NIST Special Publication 800-38G -- Recommendation for Block Cipher Modes of Operation: Methods for Format-Preserving Encryption <https://dx.doi.org/10.6028/NIST.SP.800-38G>`_
487493

0 commit comments

Comments
 (0)