Technical specification

GCRYPT V1 and V2 .gcrypt formats.

Both formats use a 60-byte public header and the same cryptographic foundation. V2 adds Zstandard compression and folder support.

Public header

60 authenticated bytes.

The full header is included in the authenticated associated data for every record.

FieldSizeV1 / V2
Magic8 bytesGCRYPT01 / GCRYPT02
Version21 / 2
KDF ID11 = Argon2id
AEAD ID11 = XChaCha20-Poly1305
Argon m_cost4KiB
Argon t_cost4passes
Argon p_cost4parallelism
Chunk size4bytes
Salt16random
Nonce prefix16random
Format V1

File / text encryption

Protected plaintext begins with one record-type byte.

TypeValue
Metadata0x01
Data0x02
End0x03

Record 0 contains metadata. No bytes may follow the final record.

Format V2

Compression + folders

Encrypted metadata also includes source type, compression algorithm, and compression level. A folder is serialized into an internal TAR stream before compression.

  • Zstandard compression.
  • Zstandard checksum enabled.
  • Symlinks rejected when creating V2.
  • Links, devices, FIFOs, and special types rejected during extraction.
  • Absolute paths and .. components rejected.

Key and nonce

key_256 = Argon2id(
  password,
  salt,
  header_parameters
)

nonce[0..16]  = nonce_prefix
nonce[16..24] = record_index u64 LE

AAD

AAD =
  header_60_bytes
  ||
  record_index_u64_le

This cryptographically binds every record to its public parameters and its position.

Compatibility

No silent format changes.

ENCRYPT in V0.1.0 continues to produce V1, while COMPRESS + ENCRYPT continues to produce V2. A future reader must inspect Magic + Version before performing any key derivation.