Gringotts file format, version 1:

FLAG | VERSION | CRC32 | ALGO | SALT | { CRC32 | DATA_LEN | [ DATA ] }

{} the part between curly braces is encrypted
[] the part between square brakets is compressed

FLAG: the Gringotts file format ID ("GRG")

VERSION: the file format version (1, currently)

CRC32: the CRC32 of the remaining file part

ALGO: the algorythms used for encryption and compression
  currently:
	0 = No encryption
	1-10 = SERPENT 128, ZLib 0-9
 
SALT: random salt used in mcrypt's IV generation

DATA_LEN: the length of the *uncompressed* DATA

DATA: the data stored in this file

Lengths:

FLAG: 3 bytes

VERSION: 1b

DATA_LEN: 4b

CRC32: 4b

ALGO: 1b

SALT: keygen algorythm dependant, for the one used it is 8b

DATA: any, up to ~16Mb

so, the final file length is (compressed DATA)+25b, and this format
allows *compressed* data size up to 512 Mb. Fair enough.
