Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarifying the encoding of ik #46

Merged
merged 1 commit into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions zip-0227.html
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,9 @@
</ul>
<p>where the
<span class="math">\(\textit{PubKey}\)</span>
algorithm is defined in BIP 340 <a id="footnote-reference-16" class="footnote_reference" href="#bip-0340">17</a>.</p>
algorithm is defined in BIP 340 <a id="footnote-reference-16" class="footnote_reference" href="#bip-0340">17</a>. Note that the byte representation of
<span class="math">\(\mathsf{ik}\)</span>
is in big-endian order as defined in BIP 340.</p>
<p>It is possible for the
<span class="math">\(\textit{PubKey}\)</span>
algorithm to fail with very low probability, which means that
Expand Down Expand Up @@ -276,8 +278,11 @@
, where</p>
<ul>
<li>
<span class="math">\(\mathsf{EncodeAssetId}(\mathsf{AssetId}) = \mathsf{EncodeAssetId}((\mathsf{ik}, \mathsf{asset\_desc})) := \mathsf{0x00} || \mathsf{repr}_{\mathbb{P}}(\mathsf{ik}) || \mathsf{asset\_desc}\!\)</span>
<span class="math">\(\mathsf{EncodeAssetId}(\mathsf{AssetId}) = \mathsf{EncodeAssetId}((\mathsf{ik}, \mathsf{asset\_desc})) := \mathsf{0x00} || \mathsf{ik} || \mathsf{asset\_desc}\!\)</span>
.</li>
<li>Note that the initial
<span class="math">\(\mathsf{0x00}\)</span>
byte is a version byte.</li>
</ul>
<p>Define
<span class="math">\(\mathsf{AssetBase_{\mathsf{AssetId}}} := \mathsf{ZSAValueBase}(\mathsf{AssetDigest}_{\mathsf{AssetId}})\)</span>
Expand Down
4 changes: 3 additions & 1 deletion zip-0227.rst
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ Define :math:`\mathsf{IssueAuthSig.DerivePublic}\: : \: (\mathsf{isk}\: : \: \ma
* Return :math:`\bot` if the :math:`\textit{PubKey}` algorithm invocation fails, otherwise return :math:`\mathsf{ik}`.

where the :math:`\textit{PubKey}` algorithm is defined in BIP 340 [#bip-0340]_.
Note that the byte representation of :math:`\mathsf{ik}` is in big-endian order as defined in BIP 340.

It is possible for the :math:`\textit{PubKey}` algorithm to fail with very low probability, which means that :math:`\mathsf{IssueAuthSig.DerivePublic}` could return :math:`\bot` with very low probability.
If this happens, discard the keys and repeat with a different :math:`\mathsf{isk}`.
Expand Down Expand Up @@ -189,7 +190,8 @@ Let
Define :math:`\mathsf{AssetDigest_{\mathsf{AssetId}}} := \textsf{BLAKE2b-512}(\texttt{"ZSA-Asset-Digest"},\; \mathsf{EncodeAssetId}(\mathsf{AssetId}))`,
where

- :math:`\mathsf{EncodeAssetId}(\mathsf{AssetId}) = \mathsf{EncodeAssetId}((\mathsf{ik}, \mathsf{asset\_desc})) := \mathsf{0x00} || \mathsf{repr}_{\mathbb{P}}(\mathsf{ik}) || \mathsf{asset\_desc}\!`.
- :math:`\mathsf{EncodeAssetId}(\mathsf{AssetId}) = \mathsf{EncodeAssetId}((\mathsf{ik}, \mathsf{asset\_desc})) := \mathsf{0x00} || \mathsf{ik} || \mathsf{asset\_desc}\!`.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the specification defines ik to be a byte string. So there is no need to use the I2BEBSP function. I have instead clarified that the representation is big-endian above (line 150)

- Note that the initial :math:`\mathsf{0x00}` byte is a version byte.

Define :math:`\mathsf{AssetBase_{\mathsf{AssetId}}} := \mathsf{ZSAValueBase}(\mathsf{AssetDigest}_{\mathsf{AssetId}})`

Expand Down