Skip to main content

📦 crunchmania

pic

A Python compressor/decompressor for Crunch-Mania files from the Amiga era.

The format

Crunch-Mania was a file cruncher for the Commodore Amiga, written by Thomas Schwarz and released between 1989 and 1994. It was designed for in-place decompression: the compressed data is read backward and the output is written backward, so a file can be decompressed into the same memory it occupies.

There are four format variants, identified by a 4-byte magic at offset 0:

Magic Mode Delta Description
CrM! Standard No Fixed Huffman + VLC
CrM2 LZH No Dynamic Huffman per block
Crm! Standard Yes Standard + delta encoding
Crm2 LZH Yes LZH + delta encoding

The lowercase m variants apply a cumulative byte delta as a post-processing step, used for sample data where adjacent bytes tend to have similar values.

Several Amiga demos and games used obfuscated copies of the format with different magic bytes (Iron, DCS!, MSS!, etc). These are detected and handled transparently.

The 14-byte header is followed by the packed data stream, which is read from the end toward the start using an LSB-first bit reader initialized from the last 6 bytes of the packed block.

Installation

pip install crunchmania

CLI usage

# Show file info
crunchmania info packed_file.crm

# Decompress a file
crunchmania unpack packed_file.crm output_file

# Scan a file for embedded CrM blocks
crunchmania scan amiga_disk.adf

Library usage

from crunchmania import unpack, parse_header

data = open("packed_file.crm", "rb").read()

# Inspect the header
header = parse_header(data)
print(f"{header.magic!r}, {header.packed_size} -> {header.unpacked_size}")

# Decompress
output = unpack(data)

License

WTFPL

Release files for crunchmania 0.2.0

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

Source distribution (sdist)

Source distribution for crunchmania 0.2.0
File Size Uploaded
crunchmania-0.2.0.tar.gz 9.1 kB Details

Built distribution (wheel)

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

Total release size: 19.5 kB

Release files / crunchmania-0.2.0.tar.gz

Download URL crunchmania-0.2.0.tar.gz
Size 9.1 kB
Tags Source
SHA-256 checksum
How to use checksums
6bb6a1858f659d5dbab1eceae1de28b30e8d260b4dadabf8fc46ddd58f40f15e
BLAKE2b-256 checksum
How to use checksums
d4c83d740707d9d432055355f118ef0bb0158033e8041aaa004ae2d6e5446323
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / crunchmania-0.2.0-py3-none-any.whl

Download URL crunchmania-0.2.0-py3-none-any.whl
Size 10.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
47f8b04ccdfbed3799498d4af26617d00331a210a55db330a90fbe3e4aaa5ac4
BLAKE2b-256 checksum
How to use checksums
545eb13924cbba6c7da701fb7ebce53e3dc7682020c1b559a22a39f58e912c6b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

0.2.0 This release

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