aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpukkamustard <pukkamustard@posteo.net>2020-10-23 16:45:19 +0200
committerpukkamustard <pukkamustard@posteo.net>2020-10-23 16:55:00 +0200
commit4b6328f87f437cdd4007d63011973617a7776cda (patch)
tree8c9eb55e668c711a44abfabb6ca3f59d83d1aeb6
parent2b03565f2f4e0f5820af518edabb07d8b19c44d6 (diff)
eris.adoc: Decoding
-rw-r--r--doc/eris.adoc29
-rw-r--r--public/index.html40
2 files changed, 68 insertions, 1 deletions
diff --git a/doc/eris.adoc b/doc/eris.adoc
index 89b7c2f..0818210 100644
--- a/doc/eris.adoc
+++ b/doc/eris.adoc
@@ -288,6 +288,35 @@ For an example, see https://gitlab.com/openengiadina/eris/-/raw/main/eris/encode
=== Decoding
+Given an ERIS read capability and access to blocks via a block-storage the content can be decoded.
+
+[source, pseudocode]
+----
+ERIS-Decode-Recurse(LEVEL, REFERENCE, KEY):
+ IF LEVEL == 0:
+ ENCRYPTED-CONTENT-BLOCK := Block-Storage-Get(REFERENCE)
+ RETURN ChaCha20(CONTENT-BLOCK, KEY)
+ ELSE:
+ ENCRYPTED-NODE := Block-Storage-Get(REFERENCE)
+ NODE := ChaCha20(ENCRYPTED, KEY)
+ OUTPUT := []
+ WHILE SUB-REFERENCE, SUB-KEY := Read-RK-Pair-From-Node(NODE):
+ OUTPUT := OUTPUT ++ [ERIS-DECODE-Recurse(LEVEL - 1, SUB-REFERENCE, SUB-KEY)]
+ RETURN CONCAT(OUTPUT)
+
+ERIS-Decode(BLOCK-SIZE, LEVEL, ROOT-REFERENCE, ROOT-KEY):
+ PADDED := ERIS-Decode-Recurse(LEVEL, ROOT-REFERENCE, ROOT-KEY)
+ RETURN UNPAD(PADDED, BLOCK-SIZE)
+----
+
+Where the block-storage can be accessed as follows:
+
+`Block-Storage-Get(REFERENCE)` :: Returns a block such that `Blake2b-256(Block-Storage-Get(REFERENCE)) == REFERENCE` or throws an error.
+
+A streaming decoding procedure can be implemented where the content can be output block wise and does not need to be kept in memory for unpadding. For an example, see https://gitlab.com/openengiadina/eris/-/raw/main/eris/decode.scm[the reference Guile implementation].
+
+Random access is possible by only decoding selected sub-trees.
+
=== Binary Encoding of Read Capability
=== URN
diff --git a/public/index.html b/public/index.html
index 692349e..660bb31 100644
--- a/public/index.html
+++ b/public/index.html
@@ -1336,7 +1336,45 @@ If the length of the last content block is exactly block size, then padding will
</div>
<div class="sect2">
<h3 id="_decoding"><a class="anchor" href="#_decoding"></a>2.5. Decoding</h3>
+<div class="paragraph">
+<p>Given an ERIS read capability and access to blocks via a block-storage the content can be decoded.</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="highlight"><code class="language-pseudocode" data-lang="pseudocode">ERIS-Decode-Recurse(LEVEL, REFERENCE, KEY):
+ IF LEVEL == 0:
+ ENCRYPTED-CONTENT-BLOCK := Block-Storage-Get(REFERENCE)
+ RETURN ChaCha20(CONTENT-BLOCK, KEY)
+ ELSE:
+ ENCRYPTED-NODE := Block-Storage-Get(REFERENCE)
+ NODE := ChaCha20(ENCRYPTED, KEY)
+ OUTPUT := []
+ WHILE SUB-REFERENCE, SUB-KEY := Read-RK-Pair-From-Node(NODE):
+ OUTPUT := OUTPUT ++ [ERIS-DECODE-Recurse(LEVEL - 1, SUB-REFERENCE, SUB-KEY)]
+ RETURN CONCAT(OUTPUT)
+ERIS-Decode(BLOCK-SIZE, LEVEL, ROOT-REFERENCE, ROOT-KEY):
+ PADDED := ERIS-Decode-Recurse(LEVEL, ROOT-REFERENCE, ROOT-KEY)
+ RETURN UNPAD(PADDED, BLOCK-SIZE)</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Where the block-storage can be accessed as follows:</p>
+</div>
+<div class="dlist">
+<dl>
+<dt class="hdlist1"><code>Block-Storage-Get(REFERENCE)</code> </dt>
+<dd>
+<p>Returns a block such that <code>Blake2b-256(Block-Storage-Get(REFERENCE)) == REFERENCE</code> or throws an error.</p>
+</dd>
+</dl>
+</div>
+<div class="paragraph">
+<p>A streaming decoding procedure can be implemented where the content can be output block wise and does not need to be kept in memory for unpadding. For an example, see <a href="https://gitlab.com/openengiadina/eris/-/raw/main/eris/decode.scm">the reference Guile implementation</a>.</p>
+</div>
+<div class="paragraph">
+<p>Random access is possible by only decoding selected sub-trees.</p>
+</div>
</div>
<div class="sect2">
<h3 id="_binary_encoding_of_read_capability"><a class="anchor" href="#_binary_encoding_of_read_capability"></a>2.6. Binary Encoding of Read Capability</h3>
@@ -1447,7 +1485,7 @@ If the length of the last content block is exactly block size, then padding will
</div>
<div id="footer">
<div id="footer-text">
-Last updated 2020-10-23 16:16:14 +0200
+Last updated 2020-10-23 16:47:30 +0200
</div>
</div>
</body>