Skip to main content

🗜️ xfh

xfh is a pure-Python library and command-line tool for recovering files compressed with the Amiga XPK system, including files written transparently through DiskExpander.

It requires Python 3.10 or newer and has no runtime dependencies.

Install

python -m pip install xfh

Help

xfh --help
xfh info --help
xfh verify --help
xfh unpack --help

You can also run the command as python -m xfh.

Use

Inspect a packed file:

xfh info packed-file

Verify that a file decompresses successfully without writing its contents:

xfh verify packed-file

Recover a file:

xfh unpack packed-file recovered-file

For an encrypted stream, xfh prompts securely for its password. In scripts, set XFH_PASSWORD; passwords are deliberately not accepted as command-line arguments because process listings can expose them.

Existing output files are not overwritten unless --force is supplied. Output is limited to 256 MiB by default; use --max-output-size to choose a different byte limit.

For a damaged stream, salvage mode writes the prefix recovered before the first failing chunk. It exits with status 4 when recovery is incomplete:

xfh unpack damaged-file recovered-prefix --salvage --report recovery.json

Keep the original packed file unchanged and validate salvaged output with tools appropriate for its file type.

Python

from pathlib import Path

import xfh

packed = Path("packed-file").read_bytes()
info = xfh.inspect(packed)
plain = xfh.decompress(packed)  # Add password="..." for an encrypted stream.

print(info.codec, len(plain))
Path("recovered-file").write_bytes(plain)

xfh.decompress_file() provides atomic, non-overwriting file output. xfh.Limits controls maximum output size, total chunk count across nested streams, and nesting depth (16 streams by default).

Supported codecs

xfh supports these XPK codec identifiers:

ACCA, ARTM, BLFH, BLZW, BZP2, CBR0, CBR1, CRM2, CRMS, CYB2, DLTA, DUKE, ELZX, ENCO, FAST, FBR2, FEAL, FRHT, FRLE, GZIP, HFMN, HUFF, IDEA, ILZR, IMPL, LHLB, LZBS, LZCB, LZW2, LZW3, LZW4, LZW5, MASH, NONE, NUID, NUKE, PPMQ, PWPK, RAKE, RDCN, RLEN, SASC, SDHC, SHID, SHR3, SHRI, SHSC, SLZ3, SLZX, SMPL, SQSH, TDCS, and ZENO.

CBR1 is an alias for CBR0; FRHT is an alias for RAKE. BLFH's packed and unpacked ECB, OFB, CFB, and CBC modes are decoded. Obsolete ciphers are included solely for recovery and must not be used to protect new data.

Release files for xfh 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xfh 0.3.1
File Size Uploaded
xfh-0.3.1.tar.gz 93.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for xfh 0.3.1
File Interpreter ABI Platform
xfh-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 159.6 kB

Release files / xfh-0.3.1.tar.gz

Download URL xfh-0.3.1.tar.gz
Size 93.2 kB
Tags Source
SHA-256 checksum
How to use checksums
38d7e038a30db45a696433bd2925b428104996fe99e5cc38c90698029499f009
BLAKE2b-256 checksum
How to use checksums
b0ace6fbcacf9d3d7f6bf5961380c4d07354e5400023abfccb92f7d00cb3a476
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.21

Release files / xfh-0.3.1-py3-none-any.whl

Download URL xfh-0.3.1-py3-none-any.whl
Size 66.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bf606aabaaafef6b0ca7c23282c0b71db2281d0df238cb1a78b6121d636fa5c1
BLAKE2b-256 checksum
How to use checksums
3d9f86fa0850a587af66bf98f6f885acb93638b33832cb68734c47af1ff34a3c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.21

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page