Ntrlegendzip [TESTED]
# ntrlegendzip/encrypted.py
def encrypt_zip(
src_paths: List[Path],
dst_path: Path,
password: str,
compression: zipfile.ZIP_DEFLATED = zipfile.ZIP_DEFLATED,
compresslevel: int = 9,
) -> None:
"""
Create a zip archive where each file is encrypted with AES‑256‑GCM.
Parameters
----------
src_paths:
List of files or directories to include. Directories are walked
recursively; the relative path inside the archive mirrors the
filesystem layout.
dst_path:
Destination ``.zip`` file.
password:
Human‑readable passphrase; will be turned into a 256‑bit key via PBKDF2.
compression:
``zipfile`` compression flag (default: ``ZIP_DEFLATED``).
compresslevel:
Integer 0‑9 controlling the deflate level (default: 9).
"""
...
def extract_encrypted_zip(
zip_path: Path,
dst_dir: Path,
password: str,
) -> None:
"""
Extract an archive produced by :func:`encrypt_zip`.
Parameters
----------
zip_path:
Path to the ``.zip`` file.
dst_dir:
Destination directory where files will be written.
password:
The same passphrase that was used when creating the archive.
"""
...
Both functions raise a custom exception hierarchy (NtlzError, NtlzBadPassword, NtlzCorruptHeader) so callers can react appropriately.
The keyword ntrlegendzip promises a "legendary" collection of niche adult content. However, the reality of anonymous file sharing is that you are trading safety for convenience. ntrlegendzip
def extract_encrypted_zip(
zip_path: pathlib.Path,
dst_dir: pathlib.Path,
password: str,
) -> None:
zip_path = pathlib.Path(zip_path)
dst_dir = pathlib.Path(dst_dir)
dst_dir.mkdir(parents=True, exist_ok=True)
with zipfile.ZipFile(zip_path, 'r') as zf:
for zinfo in zf.infolist():
raw = zf.read(zinfo) # bytes from the archive
# Detect whether this entry is encrypted with our scheme
if raw.startswith(MAGIC):
# ----- parse header -----
try:
salt, iv, tag = _parse_encryption_header(raw)
except NtlzCorruptHeader as exc:
raise NtlzError(f"Corrupt header in zinfo.filename!r") from exc
# Header length is constant
header_len = len(MAGIC) + 1 + SALT_SIZE + IV_SIZE + TAG_SIZE
ct_body = raw[header_len:]
# Re‑derive the key
key = _derive_key(password, salt)
aesgcm = AESGCM(key)
# Re‑attach the tag for decryption (GCM expects it at the end)
ciphertext = ct_body + tag
try:
plaintext = aesgcm.decrypt(iv, ciphertext, None)
except Exception as exc:
raise NtlzBadPassword("Decryption failed – wrong password or corrupted data") from exc
else:
# Plain (non‑encrypted) entry – just copy it as‑is
plaintext = raw
# Write out the file, recreating the directory tree
out_path = dst_dir / zinfo.filename
out_path.parent.mkdir(parents=True, exist_ok=True)
with out_path.open('wb') as out_f:
out_f.write(plaintext)
# Preserve modification time if present
date_time = getattr(zinfo, 'date_time', None)
if date_time:
mtime = time.mktime(date_time + (0, 0, -1))
os.utime(out_path, (mtime, mtime))
# ntrlegendzip/__init__.py
from .encrypted import encrypt_zip, extract_encrypted_zip, NtlzError, NtlzBadPassword, NtlzCorruptHeader
__all__ = [
"encrypt_zip",
"extract_encrypted_zip",
"NtlzError",
"NtlzBadPassword",
"NtlzCorruptHeader",
]
Add the cryptography dependency to the project’s pyproject.toml / requirements.txt: # ntrlegendzip/encrypted
cryptography>=43.0.0
Run the test suite (or create a quick sanity test): Both functions raise a custom exception hierarchy (
from pathlib import Path
from ntrlegendzip import encrypt_zip, extract_encrypted_zip
src = Path("demo_folder")
dst = Path("demo.zip")
pwd = "s3cr3t‑p@ss"
encrypt_zip([src], dst, pwd)
extract_encrypted_zip(dst, Path("extracted"), pwd)
Verify that extracted/ matches the original folder structure byte‑for‑byte.
"ntrlegendzip"—a string of characters that reads like an artifact from the margins of internet culture: part codename, part meme, part compressed archive. On first glance it’s inscrutable; on closer inspection it becomes a prism reflecting how identity, nostalgia, and the architecture of online memory collide. This essay treats the term as a cultural specimen: a symbol of emergent digital folklore, a label for compressed histories, and a shorthand for how communities encode meaning.