Xar Archive Format

Created: 2024-03-15T03:29:46-05:00

Return to the Index
This card pertains to a resource available on the internet.

"Extensible Archiver."

Basically a fixed-size header, with an XML file gzipped and taped on, followed by a no man's land of bytes.

The manifest stores the location and size of each file as well as how it was compressed.

Used to be used a lot on the Mac. Used for Safari extensions until it wasn't.

Header

Offset# 	Size
(in bytes) 	Purpose
0 	4 	File signature used to identify the file format as Xar.
This should always equal xar!
4 	2 	Header size
6 	2 	Version of Xar format to use.
Currently there is only version 1.
8 	8 	Length of the TOC compressed data.
16 	8 	Length of the TOC uncompressed data.
24 	4 	Checksum algorithm:

0 = none
1 = SHA1
2 = MD5
3 = SHA-256[5]
4 = SHA-512

28 	0, 4 , 36 	sometimes padding bytes or checksum algorithm name

Manifest example





0
20


staff
20
joe
501
0755
directory
com.foobar


20

501
0775
directory
Contents


428
20
1005

a5f6f1461213a904f831d4ef6f214638342842ed
21d21a0c90378248ce0dfb6f345376d1b00d65fc


20

501
0664
file
Info.plist



20

501
0775
directory
Resources


14868
448
274432

efe5c97921de7ccc5aebc158d158e9d4280d6814
45c8be42d1d9afdb57ddd5e9311453010ec46161


20

501
0664
file
foobar



17635
15316
45056

3c761ffcc81ee6e232e4f4a1c4a81654c26c4e52
0ea31f8ef0e5987a1838a64ab5c26ebf3ee4bc37


20

501
0664
file
docSet.skidx



20

501
0775
directory
Documents


35790
32951
209242

5242cd71585c34e722932f324706f8c00e1ae0c5
c0e013e53d829511835e2b429abb5198731e9a3e


20

501
0664
file
foobar.html