#apple #data #scheme #image #dmg

adc

Rust implementation of the Apple Data Compression scheme used in DMG images

3 unstable releases

0.2.1 Sep 16, 2020
0.2.0 Sep 14, 2020
0.1.0 Jul 21, 2020

#613 in Compression

Download history 37/week @ 2024-11-16 40/week @ 2024-11-23 143/week @ 2024-11-30 399/week @ 2024-12-07 276/week @ 2024-12-14 16/week @ 2024-12-21 129/week @ 2024-12-28 284/week @ 2025-01-04 298/week @ 2025-01-11 316/week @ 2025-01-18 406/week @ 2025-01-25 249/week @ 2025-02-01 295/week @ 2025-02-08 493/week @ 2025-02-15 317/week @ 2025-02-22 369/week @ 2025-03-01

1,505 downloads per month
Used in dmgwiz

MIT license

10KB
182 lines

adc-rs

Build and Testcrates.io

A native rust implementation of the Apple Data Compression scheme used for example in DMG images. Supports decompression only.

Documentation

# Cargo.toml
[dependencies]
adc = "0.2"

Example

use adc::AdcDecoder;
use std::io::Read;

let input: &[u8] = &[0x83, 0xfe, 0xed, 0xfa, 0xce, 0x00, 0x00, 0x40, 0x00, 0x06];
let mut d = AdcDecoder::new(input);
let mut data = vec![0; 11];
let bytes_out = match d.read_exact(&mut data) {
    Ok(val) => val,
    Err(err) => panic!("error: {:?}", err),
};
println!("{:?} bytes decompressed", bytes_out);

Changelog

0.2.1

  • Fixed two decoding bugs

0.2.0

  • Switched to an API based on the Read trait (breaking change)

0.1.0

  • Initial release

lib.rs:

Implementation of the Apple Data Compression scheme in Rust

ADC is a rather basic run length compression scheme. This library implements decompression only.

Example

use adc::AdcDecoder;
use std::io::Read;

let input: &[u8] = &[0x83, 0xfe, 0xed, 0xfa, 0xce, 0x00, 0x00, 0x40, 0x00, 0x06];
let mut d = AdcDecoder::new(input);
let mut data = vec![0; 11];
let bytes_out = match d.read_exact(&mut data) {
    Ok(val) => val,
    Err(err) => panic!("error: {:?}", err),
};
println!("{:?} bytes decompressed", bytes_out);

Dependencies

~115KB