X-Git-Url: http://www.git.cypherpunks.ru/?p=gohpenc.git;a=blobdiff_plain;f=FORMAT;fp=FORMAT;h=27244f3d7c508ded42c37ec0fabdfd8716ecd8c0;hp=0000000000000000000000000000000000000000;hb=d863cee82aad34900144198abf740bb7f75a4642;hpb=43162227c8405de5a2d835ee306459993ff0ba6d diff --git a/FORMAT b/FORMAT new file mode 100644 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.