Which file did you read when a ZIP lists the same path twice?

A ZIP attachment contains two entries called desk/note.txt. One says gate A, the other gate B. The path alone cannot tell a second reviewer which note you quoted. Keep the original archive and identify the entry inside it before you extract anything.

Two plain folders with matching tabs and differently coloured pages in an archive box
Matching labels can conceal different contents. The exercise uses a fictional ZIP with two entries.

Two seven-byte notes

For this exercise we built a small, fictional ZIP. Both entries carry the same path, stored modification time and uncompressed length. The first contains gate=A followed by a newline. In the second the letter is B. We opened each entry separately with Python and hashed the bytes it returned.

Entry in listing, counted from 1Local header offset in this archiveUncompressed bytesFirst 12 hex digits of SHA-256
1070a7ee31f1913
2507b2a2035066b9

The offset locates an entry’s local header from the beginning of this particular file. Repacking the archive can change it. In your notes, bind that offset or listing number to the full SHA-256 of the archive you received. Save the full member digests too. The short prefixes above just make the comparison easy to read.

Read by entry

In Python, infolist() returns a sequence of entry records. Passing one of those records to open() selects that specific member. A filename lookup cannot express “the first of two records with this exact name.” An extraction into a single folder can also collapse both entries into one destination, or the tool may ask how to resolve the collision.

from hashlib import sha256
from zipfile import ZipFile

with ZipFile("demo.zip") as archive:
    for number, entry in enumerate(archive.infolist(), start=1):
        if entry.filename == "desk/note.txt":
            with archive.open(entry) as stream:
                data = stream.read(1025)
            if len(data) > 1024:
                raise ValueError("Sample exceeds exercise limit")
            print(number, entry.header_offset, len(data), sha256(data).hexdigest())

This example reads at most 1,025 uncompressed bytes per selected entry and writes nothing to disk. It is intended for the small teaching archive. On an unfamiliar archive, inspect the listing first and set limits for the number of entries and the total uncompressed data you will process. You can leave encrypted or unreadable entries marked as such.

Cite the copy, then check the claim

Write “Entry 2 of the preserved ZIP, at local header offset 50, reads gate B.” Include the common path and both full digests with that sentence. Saying “the publisher corrected A to B” would require separate evidence of who made a change and when. The listing can establish that both records are present even if you have no revision history.

The Python documentation explains selecting duplicate names by entry object. The PKWARE format specification describes central directory entries and local header offsets. For the outer archive, follow the file-hashing guide before moving or repacking your evidence.

By OSINT Jet · Primary sources reviewed 9 November 2026.