]> Cypherpunks.ru repositories - gohpenc.git/blobdiff - FORMAT
More secure and faster version
[gohpenc.git] / FORMAT
diff --git a/FORMAT b/FORMAT
new file mode 100644 (file)
index 0000000..27244f3
--- /dev/null
+++ b/FORMAT
@@ -0,0 +1,17 @@
+Output format is very simple:
+
+* "GOHPENC\n" magic string
+* 32-bit big-endian block length
+* 128-bit random salt
+
+                           /-------BLOCK---------\ /-------BLOCK---------\
++-------+----------+------+------------+----------+------------+----------+----
+| MAGIC | BLOCKLEN | SALT | CIPHERTEXT | AUTH TAG | CIPHERTEXT | AUTH TAG | ...
++-------+----------+------+------------+----------+------------+----------+----
+
+There is trivial key generation:
+    keyOrdinary, keyLast = HKDF(SHA512, keySpecified, SALT, AD=MAGIC)
+
+Each block is encrypted with ChaCha20-Poly1305, using keyOrdinary and
+nonce containing 64-bit big-endian counter, starting at zero. Very last
+block is encrypted with keyLast and it may have zero length plaintext.