aboutsummaryrefslogtreecommitdiff
path: root/doc
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 /doc
parent2b03565f2f4e0f5820af518edabb07d8b19c44d6 (diff)
eris.adoc: Decoding
Diffstat (limited to 'doc')
-rw-r--r--doc/eris.adoc29
1 files changed, 29 insertions, 0 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