Zip-Ada: Ada library for zip files (.zip). Ada programming.

[NEW] LZMA compression supported.

What is Zip-Ada ?

Zip-Ada is a programming library for dealing with the Zip compressed archive file format. The full sources of Zip-Ada are in Ada, compilable on every compiler and for every system. For more details, read the files zipada.txt and from the archive below.
Why not call an zip or unzip executable, or use the zlib library ?
  • Independence:
    with this library you can zip and unzip data without any OS-dependent external call.
    Furthermore, you can use Zip-Ada with any data stream instead of files, for the archives as well as for the archived entries.
  • Unconditional portability (*):
    • the C code has "only" been widely ported, with specific source parts (via conditional compilation) for different OS and compilers;
    • a single Ada source code set produces a native Zip/UnZip in machine code for every OS, with every Ada compiler (sceptic ? click here to see a list of reportedly successfully tested environments).
  • No effort of interfacing: interfacing is a frequent source of maintenance troubles, compatibility issues and portability constraints.
    With Zip-Ada, it is possible to have full-Ada projects using Zip archives, compiled by a single compiler.
  • Transparency: full sources are visible; it is easier to verify and customize.
  • Benefit from the powerful LZMA compression format (for instance, zlib and zlib-based Zip tools are limited to the Deflate format).
    Additionally, Zip-Ada provides the Preselection algorithm-picking method for compressing data depending on their type and size.
(*) within limits of compiler's provided integer types and target architecture capacity.


Zip-Ada is free software under MIT license - see copyright notice in


  Download the library from the SourceForge project page.  

The archive contains:
  • The full library sources inside one directory, Zip_Lib
  • Some command-line demos, and the following tools:
    • ZipAda, a tool that creates a compressed Zip archive
    • UnZipAda, a tool that extracts some or all files from a Zip archive
    • Comp_Zip, an utility for comparing two Zip archives (compare contents, check missing files)
    • Find_Zip, an utility for searching a text string across contents of a Zip archive
    • ReZip, a tool for recompressing Zip archives towards optimal compression
    • bunzip, a tool that decompresses BZip2 compressed files (.bz2)
    • lzma_dec, a tool that decompresses LZMA compressed files (.lzma)
- unzip the archive with its directory structure ("unzip zipada*.zip");
- text-mode and lower case names can be forced for Unix ("unzip -aa -L zipada*.zip").


Zip-Ada in action
within a Zip archive
manager (AZip):

Zip-Ada in action
within a self-extracting
HTML report
from the ReZip tool:
AZip   Installer   ReZip report  

A small demo's source:

with Zip_Streams;                       use Zip_Streams;
with Zip.Create;                        use Zip.Create;

procedure Demo_zip is
  zip_file : aliased File_Zipstream; -- Archive is a file
  archive : Zip_Create_info;
  Create (archive, zip_file'Unchecked_Access, "");
  Add_File(archive, "demo/demo_zip.adb", Password => "1234");
  Add_File(archive, "demo/demo_unzip.adb");
    "==== Hello world! ====" & ASCII.LF &
    "It is such a nice ""Hello world""-like demo, isn't it ?",
  Finish (archive);
end Demo_zip;

For viewing more sources...

Browse the source (of version 53)  

Source web pages automatically generated by gnathtml (GNAT).

Present state - latest changes - history

For the full history, click here.


Mail:     Gautier de Montmollin, e-mail
For a little sponsoring (e.g. the equivalent of a glass of wine)...   Support This Project

For any news, change logs, support requests, update informations: visit the project on SourceForge! Logo

Some news about Zip-Ada and other Ada projects on Gautier's blog.

Find Zip-Ada in the Squeeze Chart benchmark :

Technical documentation: read appnote.txt (in the Zip-Ada archive).
Legal notice: free distribution copyright (read, no warranty.

Combinations (Operating System, processor, compiler) where the Zip-Ada library - one single source, zero conditional compilation - is reported to be in use:

OpenVMSIntel Itanium (64 bit) [NEW] GNU - GNAT
AIXPower7 (64 bit) [NEW]
MS Windows 9x;NT,2K,XP+Intel x86 (32 bit)
MS Windows x64Intel x64 (64 bit)
LinuxIntel x86 (32 bit)
LinuxIntel x86_64 (64 bit) [NEW]
Linux on PS3Cell (64 bit) [NEW]
Linux on Raspberry PiARM [NEW]
Mac OS XPowerPC (64 bit)
Mac OS XIntel x64 (64 bit)
SolarisSPARC (32 or 64 bit)
SolarisIntel x64 (64 bit)
MS-DOS, DR-DOS (Novell)Intel x86 (16/32 bit)
OpenBSD(one of several)
FreeBSDIntel x86 (32 bit)
FreeBSDIntel x64 (64 bit)
Android 2.3+ARM [NEW]
MS Windows 9x;NT,2K,XP+Intel x86 (32 bit)PTC - ObjectAda
MS Windows NT+Intel x86 (32 bit)SofCheck - AdaMagic
MS Windows NT+Intel x64 (64 bit)
LinuxIntel x86 (32 bit)
Mac OS XPowerPC (64 bit)
Mac OS XIntel x64 (64 bit)
SolarisSPARC (32 or 64 bit)
SolarisIntel x64 (64 bit)

Don't hesitate to tell me about other OS / CPU / compiler combinations!
Summary of supported Zip internal formats (each compressed file in a Zip archive can have a different compression format):

Other software… Info-Zip
Format Format #
Compress Decompress
PKZip WinZip UnZip Zip
store 0
v.22 v.4

shrink 1
v.22 v.4

reduce 1..4 2..5
v.29 v.4

implode 6


deflate 8
(v.40-49: limited)

enhanced deflate 9

v.2.1 v.9.0 v.5.5
bzip2 12


v.4.6 v.10.0 v.6.0 v.3.0
lzma 14
v.51 v.47
v.6.3 v.12.0

ppmd 98

v.6.3 v.10.0

Some Zip-Ada users:
The Get Ada Now site:


Some Ada compilers:
External compression tools used by ReZip: