]> Cypherpunks.ru repositories - gohpenc.git/blob - FORMAT
More secure and faster version
[gohpenc.git] / FORMAT
1 Output format is very simple:
2
3 * "GOHPENC\n" magic string
4 * 32-bit big-endian block length
5 * 128-bit random salt
6
7                            /-------BLOCK---------\ /-------BLOCK---------\
8 +-------+----------+------+------------+----------+------------+----------+----
9 | MAGIC | BLOCKLEN | SALT | CIPHERTEXT | AUTH TAG | CIPHERTEXT | AUTH TAG | ...
10 +-------+----------+------+------------+----------+------------+----------+----
11
12 There is trivial key generation:
13     keyOrdinary, keyLast = HKDF(SHA512, keySpecified, SALT, AD=MAGIC)
14
15 Each block is encrypted with ChaCha20-Poly1305, using keyOrdinary and
16 nonce containing 64-bit big-endian counter, starting at zero. Very last
17 block is encrypted with keyLast and it may have zero length plaintext.