Custom File Archive Format in Rust

Newton Toto

vach

vach, pronounced like "duck" but with a "v", is an archiving and resource transmission format. It was built to be secure, contained and protected. vach also has in-built support for multiple compression schemes (LZ4, Snappy and Brolti), cryptographic hashing, custom flags per entry and encryption. Check out the vach spec at spec.txt. Any and all help will is much appreciated.

🀄 Show me some code dang it!

let mut target = Cursor::new(vec![]);

// Data to be written
let data_1 = b"Around The World, Fatter better stronker" as &[u8];
let data_2 = b"Imagine if this made sense" as &[u8];
let data_3 = b"Fast-Acting Long-Lasting, *Bathroom Reader*" as &[u8];

// Builder definition
let config = BuilderConfig::default();

// Add data
let mut leaves = [
Leaf::new(data_1, "d1").compress(CompressMode::Always),
Leaf::new(data_2, "d2").compress(CompressMode::Never),
Leaf::new(data_3, "d3").compress(CompressMode::Detect) // picks the smaller of the compressed and uncompressed
];

// write archive
dump(&mut target, &mut leaves, &config, None)?;

// Load data
let archive = Archive::new(target)?;

// Quick assertions
assert_eq!(archive.fetch("d1")?.data.as_slice(), data_1);
assert_eq!(archive.fetch("d2")?.data.as_slice(), data_2);
assert_eq!(archive.fetch("d3")?.data.as_slice(), data_3);
For more information on how to use the library, read the documentation or explore the tests.
Like this project

Posted May 2, 2025

Developed vach, a secure archiving format with compression and encryption.

Likes

1

Views

1

Timeline

May 3, 2023 - Jan 15, 2025

Development of a Custom Lightweight DSL
Development of a Custom Lightweight DSL
pzn-sync: Lightweight Desktop App Development
pzn-sync: Lightweight Desktop App Development

Join 50k+ companies and 1M+ independents

Contra Logo

© 2025 Contra.Work Inc