-
Notifications
You must be signed in to change notification settings - Fork 1
/
FILEFORMAT.txt
41 lines (31 loc) · 1.36 KB
/
FILEFORMAT.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
File format specification for the differences file (version 1.1)
Changes since version 1.0:
Added 16 bytes to the footer containing an MD5 digest of the original
input file. This is useful to determine whether patches can be merged
in a meaningful way.
This affects only the new tardiffmerge tool, which must be able to process
both version 1.0 and version 1.1 files. The tarpatch tool ignores the extra
data, when it exists.
HEADER
8 bytes magic string: "tardiff0" (no terminating null character!)
Then, a sequence of instructions, each formatted as follows:
4 bytes: S
2 bytes: C
2 bytes: A
512*A bytes: new block data
S, C and A are unsigned integers stored in big-endian (network) byte order.
Interpret this as follows:
if S == 0xffffffff and C == 0xffff and A == 0xffff:
end of instructions has been reached
if C > 0x7fff or A > 0x7fff:
invalid data (higher values are reserved)
if S == 0xffffffff:
if C > 0: invalid data
else:
if C == 0: invalid data
else: copy blocks with index S through S+C (exclusive) to output
if A > 0:
copy extra data (A blocks) to output
FOOTER
16 bytes: MD5 digest of the resulting output file
16 bytes: MD5 digest of the original input file (since version 1.1)