When a ZIP asks for a password, it is using one of two very different encryption schemes. ZipCrypto, from the early 1990s, is supported almost everywhere and is cryptographically broken. WinZip AES, introduced in 2003, is strong when paired with a good password but is not supported by every built-in tool. Here is how each works and what that means in practice.
At a glance
| Feature | ZipCrypto (traditional PKWARE) | WinZip AES (AE-1 / AE-2) |
|---|---|---|
| Introduced | Early 1990s, PKZIP | 2003, WinZip 9 |
| Cipher | Custom stream cipher built on CRC-32 | AES-128, AES-192 or AES-256 in CTR mode |
| Key derivation | None: the password directly initialises three 32-bit keys | PBKDF2-HMAC-SHA1, 1,000 iterations, random salt per file |
| Password check | 1 byte, so about 1 in 256 wrong passwords passes it | 2 bytes (1 in 65,536), then the authentication code catches the rest |
| Integrity | CRC-32 of the original data only | HMAC-SHA1 authentication code (80 bits) over the encrypted data |
| Known weaknesses | Known-plaintext attack recovers the keys; very fast password guessing | Low iteration count; names and metadata visible |
| Method field | Unchanged (for example 8 for Deflate) plus an encryption flag | Set to 99; the real method is stored in an extra field (ID 0x9901) |
How ZipCrypto works
ZipCrypto, also called traditional PKWARE encryption, keeps three 32-bit internal keys. The password is fed through them one character at a time; then every byte of data both produces the next keystream byte and updates the keys using CRC-32 arithmetic. Each encrypted file starts with a 12-byte header, mostly random, whose last byte doubles as a quick password check.
Why ZipCrypto is weak
In 1994, Eli Biham and Paul Kocher published a known-plaintext attack on ZipCrypto. If an attacker knows roughly 12-13 bytes of a file's content as it is stored in the archive, they can recover the three internal keys in a practical amount of time without ever learning the password. With those keys, every file in the archive encrypted with the same password can be decrypted, however long the password is.
Known plaintext is easier to come by than it sounds:
- Files are often stored without compression, so the stored bytes are simply the file's own bytes.
- Many formats begin with fixed, predictable bytes, such as PNG images and ZIP-based Office files.
- One of the files may exist elsewhere unencrypted, such as a public image, a licence file or a standard library.
Separately, ZipCrypto's key setup is extremely cheap, so password guessing runs very fast. Freely available tools implement both attacks.
Treat ZipCrypto as a lock that keeps out casual eyes. It does not stop anyone who is determined to get in.
How WinZip AES works
WinZip defined AES encryption for ZIP in 2003, and it has become the de facto standard implemented by 7-Zip, WinRAR, PeaZip, Keka and Aback ZIP. For each file:
- A random salt is generated: 8 bytes for AES-128, 12 for AES-192, 16 for AES-256.
- PBKDF2 with HMAC-SHA1 and 1,000 iterations turns the password and salt into an AES key, an HMAC key of the same length and a 2-byte password verifier.
- The file is compressed first, because encrypted data does not compress, and then encrypted with AES in counter (CTR) mode.
- HMAC-SHA1 is computed over the encrypted data, and its first 10 bytes are stored after the data as an authentication code.
- The entry's compression method is set to 99, and an extra field records the AES key size, the AE version and the real compression method.
On extraction, a reader derives the keys again, uses the 2-byte verifier to reject most wrong passwords immediately, and checks the authentication code to detect a wrong password, tampering or corruption.
AE-1 vs AE-2
WinZip AES comes in two versions that differ in one detail: whether the CRC-32 of the original file is stored in the clear.
| Version | CRC-32 stored | Why |
|---|---|---|
| AE-1 | Yes | Tools can verify the decrypted, decompressed data with the usual ZIP checksum as well. |
| AE-2 | No (the CRC field is 0) | A CRC of the plaintext leaks a little information, which matters for very small files, where it can confirm a guess at the contents. The authentication code already guarantees integrity. |
Readers must accept both versions. Aback ZIP reads both and writes AE-2.
What neither scheme protects
- File names and folder structure: stored in plain text in the local headers and the central directory.
- Sizes and dates: the original size, compressed size and modification time of every file. AE-2 hides the CRC but not the sizes.
- The archive comment.
- Weak passwords: 1,000 PBKDF2 iterations was reasonable in 2003 but is low today; current guidance for PBKDF2-HMAC-SHA1 is in the hundreds of thousands of iterations or more. A short or common password can be guessed offline, so use a long random password or passphrase.
Encrypting the index too requires PKWARE's proprietary Strong Encryption Specification, which few tools support, or a different format: 7Z can encrypt file names, and dedicated file-encryption tools protect everything.
Which should you use?
Use AES-256 for anything that matters. Choose ZipCrypto only when the recipient can use nothing but a built-in extractor and the contents would do no harm if exposed. Password Protect ZIP offers both and labels them accordingly, and ZIP Viewer shows which scheme each entry in an existing archive uses.